From patchwork Mon Jul 16 11:30:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 141998 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2305655ljj; Mon, 16 Jul 2018 04:30:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpez/iUIOMCAqMkEo0VwkQLy/1t9wOoZNtEahO0vMlWjGMsl6zidQzFdlLtTU6PfAaRjnHov X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr14824377pgo.403.1531740644771; Mon, 16 Jul 2018 04:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531740644; cv=none; d=google.com; s=arc-20160816; b=o3qW/Ppuf47/BwO4nVb2XadTzl9x0Db4/22a+EJqPj8yZdOYaThligj9JaNh5RfBSa IDg3rB5Z3km86Opn0j49GkULElUDvl6F6DIVR0G3Ui1MdBLFpBrbG+9zR+vfU4ctGdJL yZHoRxZQ+10E5hufZZQZGzqa5KQGm0lYa1z41zOiKonDqldsxDFKAGGoUHdbichD1k/n FExbbx2ThA5OgtJphZfmgM6OZiPATRBW3r/nZlrBWvUXS2qX0lDsbciWaivQkNPt5YxZ pitrc+J4+yQ1Jho6HgQM0XuGX17HLJEKCTryKfydGRgIVjoqKIOnBOWlRCKy0azveBFU z5VA== 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=aP+y5jI3jU8UjL9djd5U+ev+3aMU+dHBlnMMwAoS0EI=; b=pqEmuflpTlg8vmNDQMVMhDMnX0ky0f3n24wHWGayf2lsHsqHvZ8K76Xg3BGH+JUpye KolHiSpFJOEiCU8da9CTjtqwb8xGonmfjrfLxXJJtR0seMuzTbcWn2XB43HiL/vVtRQo OgyD+A68Of1xBXnmGBYyBO5P58IB2BHvWC5XC55bosLyiS+J7K1lf9Z7C0s1JcrRTmx2 /zeUJXxpcr3MZn/V3RWF7HFtE/YtMbMaHqHhJ4UUzxZ4Zp7NPMSthd7cMxf4ML4KoXaQ N6kmFdhjE+6nx0MTOKKEFrl8Rhc7LdwpPGcRI8GvlzUAl3uDv2wU1dSY+NCnMKA/ZUP2 0CfA== 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 i1-v6si34538552pfa.219.2018.07.16.04.30.44; Mon, 16 Jul 2018 04:30:44 -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 S1731126AbeGPL5l (ORCPT + 31 others); Mon, 16 Jul 2018 07:57:41 -0400 Received: from foss.arm.com ([217.140.101.70]:57614 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728643AbeGPL5k (ORCPT ); Mon, 16 Jul 2018 07:57:40 -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 6F10015B2; Mon, 16 Jul 2018 04:30:41 -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 7E3D03F589; Mon, 16 Jul 2018 04:30:38 -0700 (PDT) From: Mark Rutland To: mingo@kernel.org, mingo@redhat.com Cc: andy.shevchenko@gmail.com, arnd@arndb.de, aryabinin@virtuozzo.com, boqun.feng@gmail.com, catalin.marinas@arm.com, dvyukov@google.com, glider@google.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, parri.andrea@gmail.com, peter@hurleysoftware.com, peterz@infradead.org, tglx@linutronix.de, will.deacon@arm.com, linux-arm-kernel@lists.infradead.org Subject: [PATCHv4 02/12] atomics/x86: reduce arch_cmpxchg64*() instrumentation Date: Mon, 16 Jul 2018 12:30:07 +0100 Message-Id: <20180716113017.3909-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180716113017.3909-1-mark.rutland@arm.com> References: <20180716113017.3909-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 Acked-by: Peter Zijlstra (Intel) Acked-by: Will Deacon Cc: Boqun Feng Cc: Dmitry Vyukov Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Thomas Gleixner --- arch/x86/include/asm/cmpxchg_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.11.0 Acked-by: Thomas Gleixner 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)