linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com,
	konrad.wilk@oracle.com, x86@kernel.org, srinivas.eeda@oracle.com,
	bp@suse.de, tim.c.chen@linux.intel.com, peterz@infradead.org,
	hpa@zytor.com
Subject: Re: [PATCH] x86/speculation: Update TIF_SPEC_IB before ibpb barrier
Date: Fri, 25 Jan 2019 19:03:26 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1901251858280.1622@nanos.tec.linutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.21.1901251637480.1622@nanos.tec.linutronix.de>

On Fri, 25 Jan 2019, Thomas Gleixner wrote:
> On Wed, 23 Jan 2019, Thomas Gleixner wrote:
> 
> > On Fri, 18 Jan 2019, Zhenzhong Duan wrote:
> > 
> > > When a task is set for updating TIF_SPEC_IB throuth SECCOMP by others
> > > and it's scheduled in the first time, a stale TIF_SPEC_IB value is
> > > picked in cond_ibpb(). This is due to TIF_SPEC_IB is updated later at
> > > __switch_to_xtra().
> > > 
> > > Add an extra call to speculation_ctrl_update_tif() to update it before
> > > IBPB barrier.
> > 
> > Errm. No. It adds that call to speculation_ctrl_update_tif() for every
> > mm switch, most of the time for nothing.
> > 
> > If at all, and we discussed that before and decided not to worry about it
> > (because it gets fixed up on the next context switch), then you want to
> > handle ibpb() from there:
> 
> Actually we need to do that. It's not only the scheduled in first
> problem. That whole thing might become completely stale in either
> direction. Care to whip up a patch?

Bah, nonsense. Brain was clearly still out for lunch and I confused IBPB
and STIBP for a moment. cond_ibpb() is the thing issues in switch_mm() and
that is not leaving a stale MSR around because we only write to it when we
need the barrier. The bit is not stale because the barrier is only issued
with the write. The bit has not to be cleared.

So the only 'issue' what happens is that switch_to() either issues a
barrier too much or misses one. That's really not a problem.

Thanks,

	tglx



  reply	other threads:[~2019-01-25 18:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 11:09 [PATCH] x86/speculation: Update TIF_SPEC_IB before ibpb barrier Zhenzhong Duan
2019-01-23 12:45 ` Thomas Gleixner
2019-01-25 15:39   ` Thomas Gleixner
2019-01-25 18:03     ` Thomas Gleixner [this message]
2019-01-28  8:28       ` Zhenzhong Duan
2019-01-28  8:36         ` Thomas Gleixner
2019-01-28  8:42           ` Zhenzhong Duan

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=alpine.DEB.2.21.1901251858280.1622@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=srinivas.eeda@oracle.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=x86@kernel.org \
    --cc=zhenzhong.duan@oracle.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;
as well as URLs for NNTP newsgroup(s).