All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andy Lutomirski" <luto@kernel.org>
To: "Babu Moger" <babu.moger@amd.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"the arch/x86 maintainers" <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	dave.hansen@linux.intel.com,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	shuah@kernel.org, jroedel@suse.de,
	"Uros Bizjak" <ubizjak@gmail.com>,
	viro@zeniv.linux.org.uk,
	"Petteri Aimonen" <jpa@git.mail.kapsi.fi>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Kan Liang" <kan.liang@linux.intel.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Fan Yang" <Fan_Yang@sjtu.edu.cn>,
	anshuman.khandual@arm.com, "Benjamin Thiel" <b.thiel@posteo.de>,
	"Juergen Gross" <jgross@suse.com>,
	keescook@chromium.org, "Sean Christopherson" <seanjc@google.com>,
	mh@glandium.org, sashal@kernel.org, krisman@collabora.com, "Bae,
	Chang Seok" <chang.seok.bae@intel.com>,
	0x7f454c46@gmail.com, jhubbard@nvidia.com,
	sandipan@linux.ibm.com, ziy@nvidia.com,
	kirill.shutemov@linux.intel.com, suxingxing@loongson.cn,
	harish@linux.ibm.com, rong.a.chen@intel.com, linuxram@us.ibm.com,
	bauerman@linux.ibm.com, dave.kleikamp@oracle.com
Subject: Re: x86/fpu/xsave: protection key test failures
Date: Wed, 26 May 2021 14:17:13 -0700	[thread overview]
Message-ID: <6bc401e7-6e34-4fbc-8ce3-a99be7966528@www.fastmail.com> (raw)
In-Reply-To: <718755e9-065e-c427-8821-228cdf8dd581@amd.com>



On Wed, May 26, 2021, at 2:14 PM, Babu Moger wrote:
> 
> 
> On 5/25/21 7:36 PM, Andy Lutomirski wrote:
> > On 5/25/21 2:37 PM, Babu Moger wrote:
> > 
> >> Investigation so far.
> >> 1. The test fails on AMD(Milan) systems. Test appears to pass on Intel
> >> systems. Tested on old Intel system available here.
> > 
> > Ten cents says that you have discovered that AMD returns a synthesized
> > value for XINUSE[PKRU] and that write_pkru() is buggy.
> > 
> > Any volunteers to fix the if (!pk) case in write_pkru() and see if the
> > problem goes away?  (Or at least to print something for the if (!pk)
> > case and seee if it gets printed?)
> 
> I inserted this patch to test this path.
> 
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index b1099f2d9800..a0bca917f864 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -151,6 +160,8 @@ static inline void write_pkru(u32 pkru)
>         fpregs_lock();
>         if (pk)
>                 pk->pkru = pkru;
> +       else
> +               printk_once("%s read_pkru 0x%x\n",__FUNCTION__, read_pkru());
>         __write_pkru(pkru);
>         fpregs_unlock();
>  }
> 
> 
> Yes. The pk value is sometimes NULL and the value in the pkru register is
> 0 at that time. Here is the dmesg output.
> 
> [    1.700889] write_pkru read_pkru 0x0
> 

Sweet, maybe I get my hypothetical dime back!   Both bugs are real.

Dave and I (mostly Dave — I’m supplying the snark) are working on an omnibus patch to fix this whole mess.

Thanks,
Andy

      reply	other threads:[~2021-05-26 21:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 21:37 x86/fpu/xsave: protection key test failures Babu Moger
2021-05-25 22:18 ` Dave Hansen
2021-05-25 22:22   ` Dave Kleikamp
2021-05-25 22:28     ` Dave Hansen
2021-05-26  0:03   ` Babu Moger
2021-05-26  0:20     ` Dave Hansen
2021-05-26 15:25       ` Babu Moger
2021-05-26 15:50         ` Dave Kleikamp
2021-05-26 16:06         ` Dave Hansen
2021-05-26 17:03           ` Babu Moger
2021-05-26  0:36 ` Andy Lutomirski
2021-05-26 21:14   ` Babu Moger
2021-05-26 21:17     ` Andy Lutomirski [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=6bc401e7-6e34-4fbc-8ce3-a99be7966528@www.fastmail.com \
    --to=luto@kernel.org \
    --cc=0x7f454c46@gmail.com \
    --cc=Fan_Yang@sjtu.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=b.thiel@posteo.de \
    --cc=babu.moger@amd.com \
    --cc=bauerman@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.kleikamp@oracle.com \
    --cc=fenghua.yu@intel.com \
    --cc=harish@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jhubbard@nvidia.com \
    --cc=jpa@git.mail.kapsi.fi \
    --cc=jroedel@suse.de \
    --cc=kan.liang@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=krisman@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=mh@glandium.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rong.a.chen@intel.com \
    --cc=rppt@kernel.org \
    --cc=sandipan@linux.ibm.com \
    --cc=sashal@kernel.org \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=suxingxing@loongson.cn \
    --cc=tglx@linutronix.de \
    --cc=ubizjak@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.