Actually, both structure are kind to me and except for some concerns Gleb's solutions seems easier to read. The first concern is Gleb's way cannot set a seperate stack for HOST_RSP, which I predefined this can be set by test suite's init function. I have discussed with Jan and he said we don't have such test cases. The second is huge function and more assembler codes, I will separate vmx_handler codes and this is not important. I have another question, I write codes like this: asm volatile("vmlaunch;seta %0\n\t" : "=m"(ret)); /* Should not reach here */ printf("%s : vmlaunch failed, ret=%d.\n", __func__, ret); goto err; while(1) { .... } Then because we use -O1 optimization param for our test cases, all the codes after "goto" are gone and I got the following error: /root/xelatex.kvm-unit-tests-vmx.git/x86/vmx.c:247: undefined reference to `vmx_return' collect2: ld returned 1 exit status So how could I disable the opt for this function or bypass such occasion? Arthur On Wed, Jul 17, 2013 at 6:54 PM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > Il 17/07/2013 12:31, Gleb Natapov ha scritto: >> On Wed, Jul 17, 2013 at 12:19:32PM +0200, Paolo Bonzini wrote: >>> Il 17/07/2013 11:03, Gleb Natapov ha scritto: >>>> This is not about taste, this is about hackability of the code. I will maintain it >>>> and I want it to be as simple as possible given task it does. Looking similar to KVM >>>> is additional bonus because the code will naturally look familiar to KVM maintainer. >>> >>> Then you may just as well write it yourself, no? >> >> What the point of the question? That may apply to any comment of any >> reviewer if it does not point to a bug. So if it compiles - apply it? > > "Looking similar to KVM" is not an interesting property when writing a > completely separate body of code. > > If we want to optimize for familiarity to the KVM maintainer, the best > way to do that is to only have the KVM maintainer write code. > >> If you do it right there will be _not point in doing_ global jumps. The >> control flow will be linear, the code will be much more readable. > > Ok, let's see what Arthur comes up with. > > Paolo -- Arthur Chunqi Li Department of Computer Science School of EECS Peking University Beijing, China -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html