Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1048786yba; Tue, 2 Apr 2019 00:54:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsdfcW3pI3r97n1b5ulgKsoeGDkssSjWUqTaHmVWXw447yXSb5oUgkskYjRyBm7eNVcbNH X-Received: by 2002:aa7:885a:: with SMTP id k26mr66582184pfo.70.1554191676921; Tue, 02 Apr 2019 00:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554191676; cv=none; d=google.com; s=arc-20160816; b=rc0F705rzEjrYsz65R5wuRz23rQvJTuzHSuOjOGbRKviCoIFq21gO51DjxvpaDCGT6 wfAz0X3c+T5Wqtp7bZl2bCjxw7QxClRHC8yrennMHD0uMRuLhtY6gX0ykdX4cFI5qvts ZNXBK/rlqS/dXKXFbX1NVn7APK+O0u9zoTlSwLcT4XnySkIgWq7LhTNGVFEqsx8ZOXmw fF2R3tqJpFVg9/RxSnC2XEOuEl+F5SmJWEDcGGctew9w+mdb3/I32Dh08hxBOLxR8WcW lhXn4xSvdOzYNObYtOmRfkVtdHF+86FZjfXC5dYi86qPu3NMmRRXHBT3/xeMek/i8OZ5 ILQw== 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=MRFaojMCQHp8ppKkLxqzrHcu9vpPjPvvh2iWAMwllvk=; b=suCfpQlVqHgMQCvJM8IoBCNmvlCzqNpRzkQczwcBU4hugqYKtzPnaTaeAKvANgdycA Q2RoNE24yx96xxVBrE+Vam0dpxSzreid4sn8GzTXlKWK2U0Y8x1OsnPUamu9L8Mz7Jrf D6y541rmWNUfp+ja/ujm+LkkUCz0EKeUf2J20ZZ4x+cFdsX5Y6j4sOo6bMUQZ/XAkAQO lF+LQr5HPNgQ3Ep92RZpuqTZ0id0Rnu9YM51yWUwbcWdkqZDfn1Z3Ye3OBwDch//CRWI +p7t0C1Y5VYps0skqvJPrXy2fvp1Y1amCImx+9vKReDLRUvmGwmIDnCq5xjsxEFWL90p AKyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=iUTyqVOL; 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 z25si10408299pgv.523.2019.04.02.00.54.21; Tue, 02 Apr 2019 00:54:36 -0700 (PDT) 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=iUTyqVOL; 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 S1729128AbfDBH1H (ORCPT + 99 others); Tue, 2 Apr 2019 03:27:07 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52626 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727498AbfDBH1H (ORCPT ); Tue, 2 Apr 2019 03:27:07 -0400 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=MRFaojMCQHp8ppKkLxqzrHcu9vpPjPvvh2iWAMwllvk=; b=iUTyqVOLIsfDZ5mBQz1jzJ+do zqc3kBrKe5/sLljS9mH1GfOU1QWSaoNjkHuIzw7LDWveY6nqNJ5VTex1yVIjAmgamPv72L3qVWSRy qMgCyXfI1oHJgrpDGQKjgEKJt+VMKkF/k03culYksLjFlAGMJzIsraUwE9vnkUReWr10pH6m/YFFL rAXSom4Ke96AHR5oJ5+96OYErpk4HvKhNY4W/SvmtfdaY9XcL40CflB0QyIJaRJgXCAY38c0zTyZR L52nG4snoV3GbBsd6hfX8FsITJ62pGkHn3X6MHSJAy2ZPj2SkYfl7mTNeELEvNh86m+Ej13J2Pr5s ytLVHIAQw==; 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 1hBDoy-00008J-Si; Tue, 02 Apr 2019 07:27:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9B1F12994D1A6; Tue, 2 Apr 2019 09:26:59 +0200 (CEST) Date: Tue, 2 Apr 2019 09:26:59 +0200 From: Peter Zijlstra To: Alexander Potapenko Cc: paulmck@linux.ibm.com, hpa@zytor.com, linux-kernel@vger.kernel.org, dvyukov@google.com, jyknight@google.com, x86@kernel.org, mingo@redhat.com Subject: Re: [PATCH] x86/asm: use memory clobber in bitops that touch arbitrary memory Message-ID: <20190402072659.GH12232@hirez.programming.kicks-ass.net> References: <20190401162408.249668-1-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190401162408.249668-1-glider@google.com> 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 Mon, Apr 01, 2019 at 06:24:08PM +0200, Alexander Potapenko wrote: > diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h > index d153d570bb04..20e4950827d9 100644 > --- a/arch/x86/include/asm/bitops.h > +++ b/arch/x86/include/asm/bitops.h > @@ -111,7 +111,7 @@ clear_bit(long nr, volatile unsigned long *addr) > } else { > asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" > : BITOP_ADDR(addr) > - : "Ir" (nr)); > + : "Ir" (nr) : "memory"); > } > } clear_bit() doesn't have a return value, so why are we now still using "+m" output ? AFAICT the only reason we did that was to clobber the variable, which you've (afaiu correctly) argued to be incorrect. So whould we not write this as: asm volatile (LOCK_PREFIX __ASM_SIZE(btr) " %[nr], %[addr]" : : [addr] "m" (*addr), [nr] "Ir" (nr) : "memory"); ? And the very same for _all_ other sites touched in this patch.