From patchwork Mon Jun 25 10:59:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 139818 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3837712lji; Mon, 25 Jun 2018 04:00:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJrOay8FyHb/n+PTZSIYPXgwBTrBYmdLgulh2jf/kLJPh10FH84EepgXSYd33UpyE2z5NkC X-Received: by 2002:a62:c8a:: with SMTP id 10-v6mr12436944pfm.27.1529924415554; Mon, 25 Jun 2018 04:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529924415; cv=none; d=google.com; s=arc-20160816; b=OWFgCk9s5D5AfBShX2sVnNqk3jbha3qO24yRl24q3IXgk1c+PRhNdRXZ1yBRaDquOz RKsvunF65C4TBvhBfln4Bf685GxI669yzaSR72mKv+ALxGCgAbafgE+sQKovxjtho5wu VndJTNtCU6Ls86tLlzhMRsI40L+xTPZqA+/aV4vA5L3A8ElZqsih5p1j47VAyiRZSA2M KIx1ghnkjivxsrTEK7/pgmFiywWDPLrKVAb0ftkl76CJ92SkFgu3Ko/YS+1mmuRv4ZO8 /sHQWwzPqq+2Lq78vu0J3Z9dsNZZPXeAE0fZrQIKaMd86P3YdZK6q0iZFEC1/AtdxS8A JKBw== 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=c++BPB3HrA+9xcHq/OURKfpi4dpyXHXNJyqbIOibK3A=; b=Ti4XQFnXeR9r8bCmZ746bWtqsuD9rss6uaKgHyEoqOq5DnEIhzMEsMhmZEQVm13Wj6 xLZKxvX5sxznfPkigrfCr4PUFtIQTODmXQVDU4qsBw6oVNtLs771UqKfRQ7kkOCN+7B6 P8/zGavCMTZrn13dUL0clzLIWA6A9P/lEXZCSEJRJye+vZK9Z2Of7YCyXo1VbFv8xrIg p0sdxGHcIX7C7Mk8H74QfuFLbJJulovorG4bxYwr4lAWc5YUVeBu2XAus7ALzM0Iu4Bi rufoP3yoROHG0060U71hzNjqS2zsSA2djBAMgcg3tWrhg/ItOdX6wsPvbExSRyG5vDXX j52A== 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 64-v6si3562175pgj.354.2018.06.25.04.00.15; Mon, 25 Jun 2018 04:00:15 -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 S932400AbeFYLAN (ORCPT + 31 others); Mon, 25 Jun 2018 07:00:13 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54588 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932340AbeFYLAL (ORCPT ); Mon, 25 Jun 2018 07:00:11 -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 D710322D7; Mon, 25 Jun 2018 04:00:10 -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 82FE63F73D; Mon, 25 Jun 2018 04:00:09 -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 , Arnd Bergmann , Dmitry Vyukov Subject: [PATCHv2 05/11] atomics: instrument cmpxchg_double*() Date: Mon, 25 Jun 2018 11:59:46 +0100 Message-Id: <20180625105952.3756-6-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 We currently don't instrument cmpxchg_double() and cmpxchg_double_local() due to compilation issues reported in the past, which are supposedly related to GCC bug 72873 [1], reported when GCC 7 was not yet released. This bug only applies to x86-64, and not other architectures. While the test case for GCC bug 72873 triggers issues with released versions of GCC, the instrumented kernel code compiles fine for all configurations I have tried, and it is unclear how the two cases are/were related. As we can't reproduce the kernel build failures, let's instrument cmpxchg_double*() again. We can revisit the issue if build failures reappear. Signed-off-by: Mark Rutland Cc: Arnd Bergmann Cc: Boqun Feng Cc: Dmitry Vyukov Cc: Peter Zijlstra Cc: Will Deacon --- include/asm-generic/atomic-instrumented.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) -- 2.11.0 diff --git a/include/asm-generic/atomic-instrumented.h b/include/asm-generic/atomic-instrumented.h index 53481b6eacdf..0d4b1d3dbc1e 100644 --- a/include/asm-generic/atomic-instrumented.h +++ b/include/asm-generic/atomic-instrumented.h @@ -450,23 +450,18 @@ static __always_inline bool atomic64_add_negative(s64 i, atomic64_t *v) arch_cmpxchg64_local(__ai_ptr, (old), (new)); \ }) -/* - * Originally we had the following code here: - * __typeof__(p1) ____p1 = (p1); - * kasan_check_write(____p1, 2 * sizeof(*____p1)); - * arch_cmpxchg_double(____p1, (p2), (o1), (o2), (n1), (n2)); - * But it leads to compilation failures (see gcc issue 72873). - * So for now it's left non-instrumented. - * There are few callers of cmpxchg_double(), so it's not critical. - */ #define cmpxchg_double(p1, p2, o1, o2, n1, n2) \ ({ \ - arch_cmpxchg_double((p1), (p2), (o1), (o2), (n1), (n2)); \ + typeof(p1) __ai_p1 = (p1); \ + kasan_check_write(__ai_p1, 2 * sizeof(*__ai_p1)); \ + arch_cmpxchg_double(__ai_p1, (p2), (o1), (o2), (n1), (n2)); \ }) -#define cmpxchg_double_local(p1, p2, o1, o2, n1, n2) \ -({ \ - arch_cmpxchg_double_local((p1), (p2), (o1), (o2), (n1), (n2)); \ +#define cmpxchg_double_local(p1, p2, o1, o2, n1, n2) \ +({ \ + typeof(p1) __ai_p1 = (p1); \ + kasan_check_write(__ai_p1, 2 * sizeof(*__ai_p1)); \ + arch_cmpxchg_double_local(__ai_p1, (p2), (o1), (o2), (n1), (n2)); \ }) #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */