[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160429223840.GA15744@test-lenovo>
Date: Fri, 29 Apr 2016 15:38:41 -0700
From: Yu-cheng Yu <yu-cheng.yu@...el.com>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...e.de>,
Sai Praneeth Prakhya <sai.praneeth.prakhya@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
Fenghua Yu <fenghua.yu@...el.com>
Subject: Re: [PATCH v4 07/10] x86/xsaves: Fix PTRACE frames for XSAVES
On Fri, Apr 29, 2016 at 03:36:12PM -0700, Dave Hansen wrote:
> On 04/29/2016 03:30 PM, Yu-cheng Yu wrote:
> > On Fri, Apr 29, 2016 at 01:25:34PM -0700, Dave Hansen wrote:
> >> On 03/04/2016 10:12 AM, Yu-cheng Yu wrote:
> >>> + for (i = 0; i < XFEATURE_MAX; i++) {
> >>> + /*
> >>> + * Copy only in-use xstates.
> >>> + */
> >>> + if (((header.xfeatures >> i) & 1) && xfeature_enabled(i)) {
> >>> + void *src = get_xsave_addr_no_check(xsave, i);
> >>
> >> How could a bit in header.xfeatures get set if it is not set in
> >> xfeature_enabled() aka xfeatures_mask aka XCR0?
> >
> > Do you mean, we should test xfeature_enabled(i) first, like,
> >
> > if (xfeature_enabled(i) && ((header.xfeatures >> i) & 1)) ?
> >
> > The result will be the same, like you said, if XCR0[i] is not set,
> > hader.xfeatures[i] cannot be set. But if XCR0[i] is set,
> > header.xfeatures[i] can be cleared.
>
> I think the xfeature_enabled(i) is probably redundant. Does it serve
> any actual purpose?
Got it.
Powered by blists - more mailing lists