From patchwork Mon Jul 16 11:30:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 142001 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2305841ljj; Mon, 16 Jul 2018 04:30:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfmYUAOQLZZoV7zPLiho8flHP81rs+MbymM87Xsv0e64yul9WXJHVgmZOpUpM8exFuEfnA3 X-Received: by 2002:a62:2119:: with SMTP id h25-v6mr17307512pfh.112.1531740656000; Mon, 16 Jul 2018 04:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531740655; cv=none; d=google.com; s=arc-20160816; b=brd2OAEP9rkJyg69r0IMVu0UHi+zVIbirIg7rT6K6Hnh7doD+Bq5Qeo9HTTRtpCe6t lk/qBnxplxChRQ2uIx8wD7tzB/uZl0MNgMj48Z+PhIwLqthMCD2I46fsZ0kIe79pPjyf vdDU2qgGnnng2qQxC6WLKNsoZvqRnKvtPr1ME/rLgiKCX5AhF/jEvk3N6RbSgBU6SuoX uWpvSqujAjuKwsjOviJhrUgEyzc7tG5TAfPJNyyJXDUuBnI86YZfZifP2xmQPZQHoGqv HBa0/noiegDjZQryYhJ74cPZtKZ2LIRzJZTLHfvPVYs71GhwnbF2O2M8ELgpksx5KAmo Qm/Q== 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=OOn/LZqJe/8TuhDlIkJz87uRlHmXeshBcIbCr5M3ggk=; b=tQVb6O76lxgI8tiVJLzH61Y9pLu3nkDmjVDZLO9ABT11EMtGNP/ZPGdy1fOuWLrPly lHGDrmTG9TlytFpN9IPPw0cIt5pTEYgI4oVY/NmWusFn+M7br7pyKR7MyxgUQCavsp3T UmD/e3MIjj4Es1MNHi+X4k2beEGrmjQSK57RSBjf4bEjHvbHz17kpPgwZeFvtaHG3EJa 0BI3bCBTj0V02SsrfJMuGYx8uCXFuyN7QnZHheC8uMQiZNaE+mXuJ2RJmsAcnICC6H+t FeFmf0aQgEIa+B3fwZAo2gm36RvtpsAJdRihJz5GW3slOSNB5363mk8/U5i5Pn23VCMo 4P9Q== 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 u12-v6si29333389pgb.280.2018.07.16.04.30.55; Mon, 16 Jul 2018 04:30:55 -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 S1731289AbeGPL5w (ORCPT + 31 others); Mon, 16 Jul 2018 07:57:52 -0400 Received: from foss.arm.com ([217.140.101.70]:57698 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728643AbeGPL5w (ORCPT ); Mon, 16 Jul 2018 07:57:52 -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 0875315AD; Mon, 16 Jul 2018 04:30:53 -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 18A473F589; Mon, 16 Jul 2018 04:30:49 -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 05/12] atomics: instrument cmpxchg_double*() Date: Mon, 16 Jul 2018 12:30:10 +0100 Message-Id: <20180716113017.3909-6-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 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 does not apply to 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 Acked-by: Peter Zijlstra (Intel) Acked-by: Will Deacon Cc: Arnd Bergmann Cc: Boqun Feng Cc: Dmitry Vyukov Cc: Ingo Molnar --- 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 */