From patchwork Mon Jun 25 10:59:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 139826 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3840234lji; Mon, 25 Jun 2018 04:02:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIS3BcQcr/bUby8cdKvXr0AinOZAPBqYQ5z9gQ8prEZezEWNtSTh7M72dVyd+LeFFVTYD64 X-Received: by 2002:a62:7db:: with SMTP id 88-v6mr12488197pfh.178.1529924523971; Mon, 25 Jun 2018 04:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529924523; cv=none; d=google.com; s=arc-20160816; b=PtmXVRDOcOfq84uBE8hu1Z+s8KC3aLMJwkCo5Z22zIhnbRD9KlIJ629MbaGR6vn/iv FNRsu2c1Qg7Owfo31vTQPT1KDN1jWy8x3NCW/vzdAPaq/UpoHSCjjBM2W+XF1OinaGyy DC7fFRh4Re0wG02UOpBQMhd321OZZSowNvoc55HLIlK/0DW5AOzr1e/0kACrUem0IOfR i2PyBp/+3hzqU1aqtyNKf1vtC/sEIUutu1HpeCm0TCtzeFQhtZJQlz3eu91YtjSj31eL LUE5bdeaVKpiLsqwooU/gsrtJWgaxQ55mbgTA0QoQDCTsDGQ4xXvG9nuSTW5hzdf7ldD B17Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JjmBwq3F7RmoKa85WdXg7804Y9J0jrOewfVgLhNQxtM=; b=AdckFbk6sWnoTM70lvkY42RALQBlq1qIHRhOhUrH3/JF2ykeIAMWvfEphIGjZ5b5Ux kFG7zN6t5YMZuzQZbucGh3Lj7CmNGeBv8MukgnrH8716cd2TEhRQ8MNZfClZt3bHRyTk 2mEnmTH/KVQUG/4QIl69iraxHUisC7sSkUv2TKXuR9oLZ9XPM678Gvu7MB5xHBGwFLl4 Pd6wCilJmRdWj/dC4BpR4fF7IgKpjOwVu0ciP6PaBj2v1+ZTeuvENwzdQjq9G6zs26j5 6uv9bczJTaucDZlyrr2jAipR7H6kH7h5wuvQ9N4SlQOaKHsOdcy3QmTrMRIcK8NGD4pO A2jA== 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 y23-v6si13681909pfk.75.2018.06.25.04.02.03; Mon, 25 Jun 2018 04:02:03 -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 S933108AbeFYLCB (ORCPT + 31 others); Mon, 25 Jun 2018 07:02:01 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54550 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932134AbeFYLAF (ORCPT ); Mon, 25 Jun 2018 07:00:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7216815AD; Mon, 25 Jun 2018 04:00:04 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CB4453F73D; Mon, 25 Jun 2018 04:00:02 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com Cc: Mark Rutland , Dmitry Vyukov , "H . Peter Anvin" , Ingo Molnar , Thomas Gleixner Subject: [PATCHv2 02/11] atomics/x86: reduce arch_cmpxchg64*() instrumentation Date: Mon, 25 Jun 2018 11:59:43 +0100 Message-Id: <20180625105952.3756-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180625105952.3756-1-mark.rutland@arm.com> References: <20180625105952.3756-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently x86's arch_cmpxchg64() and arch_cmpxchg64_local() are instrumented twice, as they call into instrumented atomics rather than their arch_ equivalents. A call to cmpxchg64() results in: cmpxchg64() kasan_check_write() arch_cmpxchg64() cmpxchg() kasan_check_write() arch_cmpxchg() Let's fix this up and call the arch_ equivalents, resulting in: cmpxchg64() kasan_check_write() arch_cmpxchg64() arch_cmpxchg() Signed-off-by: Mark Rutland Cc: Boqun Feng Cc: Dmitry Vyukov Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon --- arch/x86/include/asm/cmpxchg_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h index bfca3b346c74..072e5459fe2f 100644 --- a/arch/x86/include/asm/cmpxchg_64.h +++ b/arch/x86/include/asm/cmpxchg_64.h @@ -10,13 +10,13 @@ static inline void set_64bit(volatile u64 *ptr, u64 val) #define arch_cmpxchg64(ptr, o, n) \ ({ \ BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ - cmpxchg((ptr), (o), (n)); \ + arch_cmpxchg((ptr), (o), (n)); \ }) #define arch_cmpxchg64_local(ptr, o, n) \ ({ \ BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ - cmpxchg_local((ptr), (o), (n)); \ + arch_cmpxchg_local((ptr), (o), (n)); \ }) #define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX16)