Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3746829imm; Mon, 25 Jun 2018 04:03:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLXjPzuCc8Jc4vZTurfG4chR26Cd1mvDMjh3sNHpX+9OtCAbjAx4BLk0HgZ5nds02FlD82Y X-Received: by 2002:a63:7886:: with SMTP id t128-v6mr10443030pgc.429.1529924616731; Mon, 25 Jun 2018 04:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529924616; cv=none; d=google.com; s=arc-20160816; b=p+uIyZ2WCNzJTvHDWT5gCJusFdW/rLgp9EXybsnbEKlrDQDIfIMOc/JcwFhUCGKPkH npkw4Uf0vqwSZw/ttWg9bTzfGybv5ppCDl9zf2Y3Pj5IdISm2akEVmWr//OxzLDSp1Tx Arrjzf8Ua1DFdEl8NPRbgFkIDp2nCdLNrI9CjjqTQMUHCqSARus5o4q8EiBIhy631/Vq m3RAnSFfiCpqlD2hGYAauEkfMhWy03DsDXXqHYqP9GGgl2Waxx/XzDrLA8/dyqZMRWH0 CZ8iAbUU+q1ZiwEcoT+NiXRwvb83yj4VDaToS9VTK2D3SDuP4O18hbGvs+ERH0AJhc/a lp6w== 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 5-v6si8892858pls.450.2018.06.25.04.03.21; Mon, 25 Jun 2018 04:03: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; 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 S933050AbeFYLCB (ORCPT + 99 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(-) 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) -- 2.11.0