From: mark gross <mgross@linux.intel.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH 2/3] V5 more sampling fun 2
Date: Wed, 8 Apr 2020 13:26:52 -0700 [thread overview]
Message-ID: <20200408202652.GA136636@mtg-dev.jf.intel.com> (raw)
In-Reply-To: <20200407123955.ejjkigwkgfm2v4dt@treble>
On Tue, Apr 07, 2020 at 07:39:55AM -0500, speck for Josh Poimboeuf wrote:
> On Mon, Apr 06, 2020 at 05:34:56PM -0700, speck for mark gross wrote:
> > On Mon, Apr 06, 2020 at 05:07:14PM -0500, speck for Josh Poimboeuf wrote:
> > > > + /*
> > > > + * Check to see if this is one of the MDS_NO systems supporting
> > > > + * TSX that are only exposed to SRBDS when TSX is enabled.
> > > > + */
> > > > + ia32_cap = x86_read_arch_cap_msr();
> > > > + if (ia32_cap & ARCH_CAP_MDS_NO) {
> > > > + if (!boot_cpu_has(X86_FEATURE_RTM))
> > > > + srbds_mitigation = SRBDS_NOT_AFFECTED_TSX_OFF;
> > > > + }
> > >
> > > A 'goto out' would be helpful here; then the TSX_OFF checks below aren't
> > > needed and the flow is simplified.
> > a goto out would mess up the hypervisor check but, I'll add the goto for the
> > mid function returns that set the srbds_mitigation value.
>
> Just to clarify, I was thinking something like:
>
> ia32_cap = x86_read_arch_cap_msr();
> if ((ia32_cap & ARCH_CAP_MDS_NO) && !boot_cpu_has(X86_FEATURE_RTM)) {
> srbds_mitigation = SRBDS_NOT_AFFECTED_TSX_OFF;
> goto out;
> }
>
> As far as I can tell, that doesn't mess up the hypervisor check, since
> it only sets SRBDS_HYPERVISOR if TSX_OFF isn't set.
after looking again I agree and using the goto allows simplification of the
following if block.
> >
> > > > +
> > > > + if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
> > > > + if (srbds_mitigation != SRBDS_NOT_AFFECTED_TSX_OFF)
> > > > + srbds_mitigation = SRBDS_HYPERVISOR;
> > > > + return;
with your goto out aboe I can simplify this if block by removing the nested if.
Thanks!
--mark
> > > > + }
> > > > +
> > > > +/*
> > > > + * List affected CPU's for issues that cannot be enumerated.
> > > > + */
> > >
> > > I don't understand the comment, SRBDS seems to be enumerated above.
> > hmm, how about I remove the comment?
>
> Sounds good to me.
>
> --
> Josh
next prev parent reply other threads:[~2020-04-08 20:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 17:52 [MODERATED] [PATCH 0/3] V5 more sampling fun 0 mark gross
2020-01-16 22:16 ` [MODERATED] [PATCH 2/3] V5 more sampling fun 2 mark gross
2020-01-30 19:12 ` [MODERATED] [PATCH 3/3] V5 more sampling fun 3 mark gross
2020-03-17 0:56 ` [MODERATED] [PATCH 1/3] V5 more sampling fun 1 mark gross
[not found] ` <5e8b7166.1c69fb81.4c99a.3619SMTPIN_ADDED_BROKEN@mx.google.com>
2020-04-06 18:31 ` [MODERATED] " Kees Cook
[not found] ` <5e8b71d8.1c69fb81.64075.43abSMTPIN_ADDED_BROKEN@mx.google.com>
2020-04-06 18:34 ` [MODERATED] Re: [PATCH 2/3] V5 more sampling fun 2 Kees Cook
2020-04-06 18:37 ` Greg KH
2020-04-06 20:56 ` mark gross
2020-04-06 22:14 ` Luck, Tony
2020-04-07 7:51 ` Greg KH
2020-04-06 18:52 ` mark gross
[not found] ` <5e8b71af.1c69fb81.d8b8.ac6bSMTPIN_ADDED_BROKEN@mx.google.com>
2020-04-06 18:34 ` [MODERATED] Re: [PATCH 3/3] V5 more sampling fun 3 Kees Cook
2020-04-06 22:07 ` [MODERATED] Re: [PATCH 2/3] V5 more sampling fun 2 Josh Poimboeuf
2020-04-07 0:34 ` mark gross
2020-04-07 12:39 ` Josh Poimboeuf
2020-04-08 20:26 ` mark gross [this message]
2020-04-08 22:14 ` mark gross
2020-04-08 22:58 ` mark gross
2020-04-07 15:17 ` Thomas Gleixner
2020-04-08 20:33 ` [MODERATED] " mark gross
2020-04-08 23:21 ` Thomas Gleixner
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=20200408202652.GA136636@mtg-dev.jf.intel.com \
--to=mgross@linux.intel.com \
--cc=speck@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).