Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1996208img; Wed, 27 Feb 2019 08:49:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IY59vaGRS7+ZOI5Gun9Yv7kta0scezNAlvTLFdw8GGdKxeABafvy6wHxChJ+f1sYiefKxBS X-Received: by 2002:a17:902:778c:: with SMTP id o12mr3102180pll.112.1551286156198; Wed, 27 Feb 2019 08:49:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551286156; cv=none; d=google.com; s=arc-20160816; b=tDvH5iR8rZhWDbHvx08VdT0fXgimDne6F7xfzftc3cZuOyDxx+WlTosHfQk4xeziRv cAEDUJ/jy4Oyxfvlg5BZl09q7lj7Z2YFjFSCXLQ+Bjqa3zIuRtCBqzw1DWOSde5pNGVv eSFPsMq5MpzNYNLoCIWwBqRx14ew/HfKbs2+XEs+0u530cR9Dz8tZKsQkOqfD9VSGLKU pjevTzXDmThcFbfWKtuKHhziq0fFr/JJg/ygxZkubs/taE+8Pi2aYnHQO6vEfnO9xnSF ITRysIEXPFGvxoGxXrPOikXaZq85UMiKabJhAkqw0rET0DTQj2uESbXaaCwSBdBcGnyO b+Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KlgGlH0vyJgIWJ5ptP0cVzN5hIiwpYj1Ku9/HbY2Nts=; b=gDxgvsrPIWpye8HoPdCsytxlQDfHdfiaLtQPN4JpzXoON2aqetDP6mt7TXnNSjr38F KYYJzBoyezjylraMRKERWVy6Uq4t+eJeDvRZ2g2fMqInuQkZfQn8QiXlD0N5oL6ZSiPF 8kalzM0PGXDWYG98QjuwJEbBc63WzsMX/fbe79jJyPOisjz0kgufSh3v9P3/Ry+PSr3A Q38x9gvpD6F2a8Ka4RDrNXYwCorRyt5m2O5Pb06MCHW4n7GhNklL6fW0uem70Po+gLCz NUACA1RfETKnpZ1ewZunWvpd6P9ikbnHnK8KyA4HLiBUhARq5hsnblIQEZpG30o/m+Z2 f+8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=uZ1ayEKO; 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 t10si16215298plh.91.2019.02.27.08.48.59; Wed, 27 Feb 2019 08:49:16 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=uZ1ayEKO; 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 S1728025AbfB0QsS (ORCPT + 99 others); Wed, 27 Feb 2019 11:48:18 -0500 Received: from merlin.infradead.org ([205.233.59.134]:35842 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbfB0QsS (ORCPT ); Wed, 27 Feb 2019 11:48:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KlgGlH0vyJgIWJ5ptP0cVzN5hIiwpYj1Ku9/HbY2Nts=; b=uZ1ayEKOCfMdXEM03pA87JVZK 5FeHljmYLx4gYsqGFI2W/YhEw/GQxieBdduapBhVe1LSPFtlC6ILXZ0lYEh0Pc/u8MWd9Bjzspv2R zynhbnmdxkRTPY5dXuirOTEUm6pzvrMGGrT4e/ADi7F7rdy6fBzBsGsFSiYX3YdbNH4XiLR+PztW3 EwosPmgRPQEvYgsOkbbD1MrPsJLlgWjOXzQtCcm2mjSZ5OhyuQreIhH1j+2GUt8KqTwIHJ2LeXxpI ub6apoUIOf4eJrEDgHlwR7427o3dGeuBDllxFLRAjbJDfafAiEpO/t/+gNh8JHUZzEtlKHt7YbGkv CN2A5m8zA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gz2NM-0005DP-MC; Wed, 27 Feb 2019 16:48:08 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 60971202CAE24; Wed, 27 Feb 2019 17:48:06 +0100 (CET) Date: Wed, 27 Feb 2019 17:48:06 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: Ingo Molnar , Borislav Petkov , Thomas Gleixner , Andrew Lutomirski , Nadav Amit , Linux List Kernel Mailing , Nadav Amit Subject: Re: [PATCH 1/5] x86/percpu: Differentiate this_cpu_{}() and __this_cpu_{}() Message-ID: <20190227164806.GS32494@hirez.programming.kicks-ass.net> References: <20190227101252.413192716@infradead.org> <20190227101544.210748832@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 27, 2019 at 08:14:09AM -0800, Linus Torvalds wrote: > On Wed, Feb 27, 2019 at 2:16 AM Peter Zijlstra wrote: > > > > Nadav Amit reported that commit: > > > > b59167ac7baf ("x86/percpu: Fix this_cpu_read()") > > > > added a bunch of constraints to all sorts of code; and while some of > > that was correct and desired, some of that seems superfluous. > > Hmm. > > I have the strong feeling that we should instead relax this_cpu_read() > again a bit. > > In particular, making it "asm volatile" really is a big hammer > approach. It's worth noting that the *other* this_cpu_xyz ops don't > even do that. Right, this patch 'fixes' that :-) > I would suggest that instead of making "this_cpu_read()" be asm > volatile, we mark it as potentially changing the memory location it is > touching - the same way the modify/write ops do. > > That still means that the read will be forced (like READ_ONCE()), but > allows gcc a bit more flexibility in instruction scheduling, I think. Ah, fair enough, I'll spin a version of this patch with "+m" for this_cpu and "m" for raw_cpu. > That said, I didn't actually check how it affects code generation. > Nadav, would you check the code sequences you originally noticed? Much of it was the ONCE behaviour defeating CSE I think, but yes, it would be good to have another look.