On 06/25/2011 10:44 AM, Yang, Wei Y wrote: > >> >>> +void set_cr4_smep(int smep) >>> +{ >>> + unsigned long cr4 = read_cr4(); >>> + >>> + cr4 &= ~CR4_SMEP_MASK; >>> + if (smep) >>> + cr4 |= CR4_SMEP_MASK; >>> + write_cr4(cr4); >>> +} >>> + >> >> It can work if the box does not support SMEP? > > It will report unhandled exception 13 in access.out which > we count as errors either. Do we need verify it before > running the smep test case? > It can generate the wrong report that is not caused by the fault of KVM, we'd better avoid it. >> >>> void set_efer_nx(int nx) >>> { >>> unsigned long long efer; >>> @@ -176,7 +188,7 @@ void ac_test_init(ac_test_t *at, void *virt) >>> >>> int ac_test_bump_one(ac_test_t *at) >>> { >>> - for (int i = 0; i < NR_AC_FLAGS; ++i) >>> + for (int i = 0; i < NR_AC_FLAGS-1; ++i) >> >> Why not test "SMEP" for all test case? > > It's actually the last question. :) > The page where the current code stays is user page. > If enabled SMEP, we must add some code to convert the current page > into kernel page, or the page fault will occur again and again. And it seems > no need to test SMEP for all test case. We just need fetch access which we > do in a separate case. > Oh, i see, thanks for your explanation, i think we'd better test SMEP for all kinds of access, but i don't have strong opinion :-) -- 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