Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1905961ybb; Fri, 29 Mar 2019 13:53:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7DRd5u/BWyPznVHjcCykzllDB6+UOu32ZewiHTX5rGp3Vvryh2QhjJ17ATNH+Eeu17enx X-Received: by 2002:a62:ee0a:: with SMTP id e10mr30827559pfi.6.1553892832930; Fri, 29 Mar 2019 13:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553892832; cv=none; d=google.com; s=arc-20160816; b=qrH5lohUWhGp3GrpyM3XrVFEML6cDxogFTZE2S9qCNuQf1DAGyAdpIhafrSuO2EbRM mYnYCCxjFywCQiktLsaoZV7s77NOF4m73DmPCiDTVg2cGiuTI2RhTZI5UFOQR5e+xGup UUDVNVtT9HfTznYO/gg3lv/1XLxmrkxvgav1nBcRLCdyAqHXH7qofWWbM5+JdEeuLxL9 2ImfCFsIWIS/M89Vm+mYa6L4Rhxp6VJ6vGGJTyOdC6hOycZMvCGqEUi/pk4QezOmeSyy mLvEdHiu04tzQhGPgQJeRb3dBsgI7NI6ANhLWrL2D2rUyhIfDO7SacmujbSTZc0tBg9j iL/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=STExmnlh/5sleJIzwTukLnPTTxm8mvdcGDBMVTD3Cfw=; b=iA3/SJmuzIbE3BdQSnQKG+MA302WsHd6LdtRW21xIhM0RWvyK4OLMQTDuIz5VUZtcZ o+GaeyLj7qZVSEb6PMFV2ZMz82sAmYNsVb8/kpsPNahEOX+sZVSuPWQEd+in6UoU/Ybq KuA0dKSMksHA7C4VGscD165R0EBrRdKnokX3zLdUBlLpV2XMLcheVyY6vkb9pBKcMVm8 edPCM8hRm7xpouTcNKgybJxTbbAfjYuJ1yRrpCT7VwtuLgMfTj0+Yb/ffZ4d90u1HLZ8 UPlYKt5bLHx1vshLFb5o45VxYsXQK5NkTMSQM2v06Zup9C1MqR5X25MU8h2vVNO79mgs gpew== 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 o12si2644501pgp.94.2019.03.29.13.53.37; Fri, 29 Mar 2019 13:53:52 -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; 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 S1730285AbfC2Uwv (ORCPT + 99 others); Fri, 29 Mar 2019 16:52:51 -0400 Received: from terminus.zytor.com ([198.137.202.136]:33093 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730104AbfC2Uwv (ORCPT ); Fri, 29 Mar 2019 16:52:51 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8680:2bb0:e269:95ff:fe35:9f3c]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id x2TKqd0Q3942739 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Fri, 29 Mar 2019 13:52:39 -0700 Subject: Re: Potentially missing "memory" clobbers in bitops.h for x86 To: Alexander Potapenko , Paul McKenney Cc: Peter Zijlstra , Ingo Molnar , LKML , Dmitriy Vyukov , James Y Knight References: <20190328162222.GO4102@linux.ibm.com> From: "H. Peter Anvin" Message-ID: <8e32ab34-c14c-1ccb-76f9-0dcd729a0ef6@zytor.com> Date: Fri, 29 Mar 2019 13:52:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/29/19 8:54 AM, Alexander Potapenko wrote: > >> Of course, this would force the compiler to actually compute the >> offset, which would slow things down. I have no idea whether this >> would be better or worse than just using the "memory" clobber. > Just adding the "memory" clobber to clear_bit() changes sizes of 5 > kernel functions (the three mentioned above, plus hub_activate() and > native_send_call_func_ipi()) by a small margin. > This probably means the performance impact of this clobber is > negligible in this case. I would agree with that. Could you perhaps verify whether or not any of the above functions contains a currently manifest bug? Note: the atomic versions of these functions obviously need to have "volatile" and the clobber anyway, as they are by definition barriers and moving memory operations around them would be a very serious error. -hpa