Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp739573imu; Fri, 25 Jan 2019 10:05:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN4+RNdkE1wiDVzq3b/ymLQFDjMzf5FEk4/fn8ad43SyRxgB/Zr/S7HsP/WayuMSxZGo4vkG X-Received: by 2002:a63:b30f:: with SMTP id i15mr10905171pgf.240.1548439528349; Fri, 25 Jan 2019 10:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548439528; cv=none; d=google.com; s=arc-20160816; b=Qu/ZvAYfXvMLs49sBB7YZFnWGIdhh/k6F7hklW84KyyAaDnRtCIdX/YS1qX3FbjmlW mrAbOtUQUrDsy0SuJ45HuzZI+18De1Ew62uswNj6xApogxdUR2MbPNkIiaHRA+7mpQEQ MYy3kGzA+eTLz3tzXADBBI9CRs2nSqNDDXSAzRuAs5McqGdS6bvH6bjxP+JMgitRW2kX 90KarLxGUdoR8q2CVNq2tLyu9ItHi8kAClAF7a1z+DCTP3OzabeqBnLcu+bE9Yk0jcDK IcFuB0PvOLi6DlRF1m/gFT5x0AyL1mBRhj9r23WKg487pvyNuC3Ct0EGg/luZnjgUSZG uH4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=dw9u5ksSHkgmFZsBqPZGI5Dj6YDwILF4NqChf8cmVHA=; b=b7De9sx5U/d+h/mD6y/ox/jfDCqOwUOQowjfUlJ+lpigCRo3TkKiG60VZ/r+CY8Piw r1w4TRCtzFHNhnZ2C7NHH7HBCj6C9RPCaQJIipiVnAMLp0hdzwEkVu0LvNEVs/Yz2Wkm adgs2Bg2wcnXwEIspLnMQur2RvmhkaNw0VDQbFS74jWqmr3UetwwCkhapVAQ4U4RPKKf JTnto5R6kAW00O0EIOCzC/zgj6C4Ps7QABQbf2mN6B09uj1RFwVCAl0D8lmQGpZj4MEW 4KPDeX+jQpfnIpth6bIvFPuXUmjri4XyOCqV1PfV1bhWqZvST7QLBBdoa7lYttMTRxNK azIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si25415260pgl.106.2019.01.25.10.05.12; Fri, 25 Jan 2019 10:05:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729135AbfAYSDb (ORCPT + 99 others); Fri, 25 Jan 2019 13:03:31 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:38979 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfAYSDb (ORCPT ); Fri, 25 Jan 2019 13:03:31 -0500 Received: from [79.234.67.100] (helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gn5p8-0002ob-MF; Fri, 25 Jan 2019 19:03:26 +0100 Date: Fri, 25 Jan 2019 19:03:26 +0100 (CET) From: Thomas Gleixner To: Zhenzhong Duan 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 In-Reply-To: Message-ID: References: <48a105d3-fa32-40e4-9775-37d49f42eac0@default> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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