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: Wed, 23 Jan 2019 13:45:46 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1901231335570.1628@nanos.tec.linutronix.de> (raw)
In-Reply-To: <48a105d3-fa32-40e4-9775-37d49f42eac0@default>

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:

        if (likely(!((tifp | tifn) & _TIF_SPEC_FORCE_UPDATE))) {
                __speculation_ctrl_update(tifp, tifn);
        } else {
                speculation_ctrl_update_tif(prev_p);
                tifn = speculation_ctrl_update_tif(next_p);

                /* Enforce MSR update to ensure consistent state */
                __speculation_ctrl_update(~tifn, tifn);

------> Force update IBPB

        }

Thanks,

	tglx

  reply	other threads:[~2019-01-23 12:45 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 [this message]
2019-01-25 15:39   ` Thomas Gleixner
2019-01-25 18:03     ` Thomas Gleixner
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.1901231335570.1628@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).