mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Dave Hansen <dave.hansen@intel.com>,
	David Vrabel <david.vrabel@citrix.com>,
	linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org
Subject: Re: [PATCH] x86: skip check for spurious faults for non-present faults
Date: Thu, 15 May 2014 14:20:15 -0700	[thread overview]
Message-ID: <2edd49ee-077e-4126-b09a-077b7f6be553@email.android.com> (raw)
In-Reply-To: <53752885.5080306@intel.com>

I'm trying to wrap my head around any forward compatibility concerns... if we misidentify a fault as spurious that would be bad.  

On May 15, 2014 1:50:13 PM PDT, Dave Hansen <dave.hansen@intel.com> wrote:
>On 05/12/2014 03:29 AM, David Vrabel wrote:
>> -	/* Reserved-bit violation or user access to kernel space? */
>> -	if (error_code & (PF_USER | PF_RSVD))
>> +	/* Only check for spurious faults on supervisor write or
>> +	   instruction faults. */
>> +	if (error_code != (PF_WRITE | PF_PROT)
>> +	    && error_code != (PF_INSTR | PF_PROT))
>>  		return 0;
>
>This changes the semantics a bit too much for me to feel happy about
>it.
> This is at best missing quite a bit of detail from the changelog.
>
> 1. 'return 0' means "this was not a spurious fault"
> 2. We used to check for the presence of PF_USER|PF_RSVD
> 3. This patch checks now for two _explicit_ conditions, which
>    implicitly check for the _absence_ of the two bits we checked for
>    before.
>
>I do believe your patch is correct, but it took me a bit to convince
>myself that it was the right thing.  Please be explicit (in the
>comment)
>about the exact PTE transitions that you expect to get you here.
>
>Also, I have to wonder if you can just leave the original if() in
>there.
> You're making this _more_ restrictive than it was before, and I wonder
>if it might just be more clear if you have both checks.  The compiler
>might even compile it down to the same code, just changing the
>immediate
>that was generated for the mask that you're checking.

-- 
Sent from my mobile phone.  Please pardon brevity and lack of formatting.

  reply	other threads:[~2014-05-15 21:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 10:29 David Vrabel
2014-05-15 20:50 ` Dave Hansen
2014-05-15 21:20   ` H. Peter Anvin [this message]
2014-05-16 16:54     ` Dave Hansen

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=2edd49ee-077e-4126-b09a-077b7f6be553@email.android.com \
    --to=hpa@zytor.com \
    --cc=dave.hansen@intel.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®