public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: "Yang, Wei Y" <wei.y.yang@intel.com>
Cc: "avi@redhat.com" <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"Li, Xin" <xin.li@intel.com>,
	"Shan, Haitao" <haitao.shan@intel.com>
Subject: Re: [PATCH kvm-unit-tests] access: check SMEP on prefetch pte path
Date: Mon, 27 Jun 2011 14:02:42 +0800	[thread overview]
Message-ID: <4E081D02.1060906@cn.fujitsu.com> (raw)
In-Reply-To: <5D8008F58939784290FAB48F549751984686BBA312@shsmsx502.ccr.corp.intel.com>

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 :-)

      reply	other threads:[~2011-06-27  6:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24  7:16 [PATCH kvm-unit-tests] access: check SMEP on prefetch pte path Yang, Wei
2011-06-24  9:11 ` Xiao Guangrong
2011-06-25  2:44   ` Yang, Wei Y
2011-06-27  6:02     ` Xiao Guangrong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E081D02.1060906@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=haitao.shan@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=wei.y.yang@intel.com \
    --cc=xin.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox