From patchwork Thu Oct 26 07:38:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "wuqiang.matt" X-Patchwork-Id: 13437317 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF4AF623 for ; Thu, 26 Oct 2023 07:38:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="MTVi1uRq" Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 648D8D6 for ; Thu, 26 Oct 2023 00:38:45 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b36e1fcea0so523662b3a.1 for ; Thu, 26 Oct 2023 00:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698305925; x=1698910725; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZG3qoWCwoxT+TLCEuUt16k9wNNeW+1r80cBnWyU8Z+U=; b=MTVi1uRqgTV8TDuladvd+64U6hbGlqor/TPLaglRVo7lkqk8IOK4QlLoKYfmsf085n g9UQyYgmAkX0AyphPaxahd7/bUuyixft4ixjj+vI0WqSqjE6Khg29TYFjXdltLPVf8uV WSO101nRINT6H4xqIiNSDhvUenKr/6NEzaLq7GYVaOKxbuAhVDPswUtKz99m+woXwn5R bDuJlZ1KpbzqOol9ah7unWTwwxjr9DUZPfc9z+xDE9VpdtQLDwm0tCGZoAFie3Asj/q/ sXSzOWLUSzVAJhbSMtqJNv2PcnpcZvzwtJOdp+KJaZFOCJ99of6QqeilS8GtqupVxHFI JTvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698305925; x=1698910725; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZG3qoWCwoxT+TLCEuUt16k9wNNeW+1r80cBnWyU8Z+U=; b=CxlKi1vbNtiImlcmjuytjTHJZ5XMGULGWEndaQgQx4JwbuWYP3zeQ33tovpbiGX1+R YAE83hSuIEaIVXfn5mPXBzmh7rKPF1PFu5aKWnD5q5Vw+cIdf71EBMmANFZsJCzGxz+r QH3SPzhb+PzZhOAGCo1nD6YkQvl3pO8kHtcYbFnZNFHNGjegjlI8/FVdRvkCPuMHzRXc IuOd6u3UjLjD8HzN20EOnEFmk3O5CONlTXFRh/IFY83qJ044uzKrQRYUTNJGJSjjSYEE pfXY2frvIEFm6xPWYcyxMh7hD+w4rne3/HJ7o0w/oAWANC19QR6/qs3TZzF6gmilPsZX mfhA== X-Gm-Message-State: AOJu0YwceXqZDR19x08a3PdUuih56/Gh/hDnoA34bZphSHIJY4bcwWFF U/ypzioKKbYb0jVS5T23taCBMQ== X-Google-Smtp-Source: AGHT+IHq6kCr2WgiybVkVsJdkg6kX0FUjTQTwtH6Fh9MoRIQ0MX9TAkqJRXMowX33tJNLT1ray7uJw== X-Received: by 2002:a05:6a21:6da2:b0:16c:b5ce:50f with SMTP id wl34-20020a056a216da200b0016cb5ce050fmr7544436pzb.32.1698305924849; Thu, 26 Oct 2023 00:38:44 -0700 (PDT) Received: from devz1.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id s66-20020a625e45000000b0068bc6a75848sm11020071pfb.156.2023.10.26.00.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 00:38:44 -0700 (PDT) From: "wuqiang.matt" To: Vineet Gupta , Palmer Dabbelt , Ingo Molnar , Geert Uytterhoeven , "Peter Zijlstra (Intel)" , Andi Shyti , Andrzej Hajda Cc: linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, mattwu@163.com, "wuqiang.matt" Subject: [PATCH 1/3] locking/atomic: arc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local Date: Thu, 26 Oct 2023 15:38:27 +0800 Message-Id: <20231026073828.702105-1-wuqiang.matt@bytedance.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 arch_cmpxchg[64]_local() are not defined for arc architecture. This patch implement them with generci_cmpxchg[64]_local, advised by Masami Hiramatsu. Closes: https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2 Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.Ir5uukOG-lkp@intel.com/ Signed-off-by: wuqiang.matt --- arch/arc/include/asm/cmpxchg.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h index e138fde067de..ef644cdbe956 100644 --- a/arch/arc/include/asm/cmpxchg.h +++ b/arch/arc/include/asm/cmpxchg.h @@ -140,4 +140,18 @@ #endif +/* + * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local + * are atomic with respect to current cpu. + */ +#include + +#define arch_cmpxchg_local(ptr, o, n) ({ \ + (__typeof__(*ptr))__generic_cmpxchg_local((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n), \ + sizeof(*(ptr))); \ +}) +#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) + #endif From patchwork Thu Oct 26 07:39:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "wuqiang.matt" X-Patchwork-Id: 13437318 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20DAB623 for ; Thu, 26 Oct 2023 07:39:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="O6o1iYaE" Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A1C184 for ; Thu, 26 Oct 2023 00:39:20 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6ba172c5f3dso549889b3a.0 for ; Thu, 26 Oct 2023 00:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698305960; x=1698910760; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5k67Hyx/3tO2irTOWAzuyS8QjyluKIuu0eflWrJg2/E=; b=O6o1iYaEeQK2As7r7AUA74Ohv3FqDslN3Hgn2+iMYoJt+PvwUoae5d8THhCRszetzV 4IACqsIlpqozrdVy1G026Z0MPogaOUOJzz+zHbzsvxqU99/uDytyLcH2C0OsFBzqdiTF zJZq9D5rKkkEWvKL7Lw35IuzjMSCY7MRS2CLD6iSkLtWB4qHLzkuCQYF+XVuWZ3a7n/9 tZUBI4ObGz1XWq5J3elYlfOAK1qLI7qLss+qDnd/SXKeV/lynADMViqYyL+I6m/tba0i jxFxy51RXAmolvJFPfOHGWSTrTdXiu13SDHYmMFDi8CS9EtFqEkssQzISDo8lrxNTOS5 ohVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698305960; x=1698910760; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5k67Hyx/3tO2irTOWAzuyS8QjyluKIuu0eflWrJg2/E=; b=InsjKAYx1XXaI0jR+kd20x4TV1T8utzVuYCjpBGCzxFLxsQicFt+QyYmAIgsdHDqyq x+uJd4kkntvtp+fIAj7gfmcRnQQzkNMM1RbESiTp0Sv+GmCF7tKzkKBLfuDyq1KZhI8o 6omN3zt5SSeWPTbbZAr/uVPX3Tpkc4J0oxSkzqt4AZ3CksGxo0sPQcxuI8piPZps2CME P31pRVGdmvGWcyNenPSbGe9BTSs88uQHB0HGd5BgGbeOxpPzU1cIkGH7lythPigt0Nq6 DhUetLMye7GhpO1iQVBzG57fuSrGjxugPbqG9IaQGHS14t/DrHjbAngFMLBVwiTKC4Om jWlw== X-Gm-Message-State: AOJu0YwDdEzHoI33km6BSf1lSoTeuj9EC6fb9w7qAKNRvBqFf96CxJkQ WQgbeSxJNzCUj/bbZ1s/FSPZWg== X-Google-Smtp-Source: AGHT+IGILFhcFkGFRHLmdKRDpNuEc4Fn/eaOxfCN4+XWBjWpQ8AbXagO1jKjSOBaYcn37leswMRgNg== X-Received: by 2002:a05:6a21:7906:b0:152:be08:b013 with SMTP id bg6-20020a056a21790600b00152be08b013mr7124964pzc.42.1698305960266; Thu, 26 Oct 2023 00:39:20 -0700 (PDT) Received: from devz1.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id z10-20020aa7990a000000b0068bbe3073b6sm9568848pff.181.2023.10.26.00.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 00:39:19 -0700 (PDT) From: "wuqiang.matt" To: Brian Cain , "Peter Zijlstra (Intel)" , Geert Uytterhoeven , Andi Shyti , Andrzej Hajda , Ingo Molnar Cc: linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, mattwu@163.com, "wuqiang.matt" Subject: [PATCH 2/3] locking/atomic: hexagon: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local Date: Thu, 26 Oct 2023 15:39:01 +0800 Message-Id: <20231026073902.702153-1-wuqiang.matt@bytedance.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 arch_cmpxchg[64]_local() are not defined for hexagon. So implement them with generci_cmpxchg[64]_local, as advised by Masami Hiramatsu. Closes: https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2 Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.Ir5uukOG-lkp@intel.com Signed-off-by: wuqiang.matt --- arch/hexagon/include/asm/cmpxchg.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h index bf6cf5579cf4..c14520730194 100644 --- a/arch/hexagon/include/asm/cmpxchg.h +++ b/arch/hexagon/include/asm/cmpxchg.h @@ -72,4 +72,18 @@ __arch_xchg(unsigned long x, volatile void *ptr, int size) __oldval; \ }) +/* + * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local + * are atomic with respect to current cpu. + */ +#include + +#define arch_cmpxchg_local(ptr, o, n) ({ \ + (__typeof__(*ptr))__generic_cmpxchg_local((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n), \ + sizeof(*(ptr))); \ +}) +#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) + #endif /* _ASM_CMPXCHG_H */ From patchwork Thu Oct 26 07:39:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "wuqiang.matt" X-Patchwork-Id: 13437319 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 060FB623 for ; Thu, 26 Oct 2023 07:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="Fquq9CpL" Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B102184 for ; Thu, 26 Oct 2023 00:39:51 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-27e1eea2f0dso435632a91.1 for ; Thu, 26 Oct 2023 00:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1698305991; x=1698910791; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=T+9VBh6cqcNium9L3qNrheT8GGQUxnbiy5WokL/gQlQ=; b=Fquq9CpLRufAkQ1uF4GPQAmwtRQXaCgyyPQfJzvilPMbcqJqrT52+wVn7oIf3VGiUu fLNsTCH85EUXUWNOHjSmg9LXsZTjQQkPWsXp4MfBLdwsdY8MQ9xkreHDO3gv0w18V458 hwFKgKgKoFkL6omujMXRszUQu/9DCmOxL+R9p7Eye0QyMljagmkK+1jK/ienUXBcXjIy PlkgewxRWgXio9ZmMatTRh0xULxUdin8Dp3eTCCdVTxotUWIOnlXxklL/7yoJZtwBPl7 ODuIKPW4DbmWYxmCm/ctetaJxKz9nZAqhESMAQp+9ztyncKDIL+k8Z40pde+YvgEFVPv SU7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698305991; x=1698910791; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T+9VBh6cqcNium9L3qNrheT8GGQUxnbiy5WokL/gQlQ=; b=E/Ki28LWympr//In2Dl2FISrr32iH2yEhNCAEQiCulm46b4TtJX6FrQr9V/rMrDqwK ASELkt0WmX+P5+gemh2ePAJxTiHQqHfwbOrnxIufjQ2SNu0H8DtlQ+ofxKSfKdM7y68W 2AMnkMF69pMpqQNE7QxK+e0KyPh0oP14LGPip05tQhslQmSg/19WKnGP018y4/GtvDSz Xm5/AJ6hv9BmPC02HGJ66RXIp/3u57hqHISBNlZP7jld0ar+emfkMTSAaevRw3o/RWCq +FVltzTpdXF/avT2JVg0NCs6CVWYPzQEg2zvC+mGj42oIuYhNSsfGMZg349ZyTNGzxeK Zxew== X-Gm-Message-State: AOJu0YxkCoYVtg0ObY62BtcHZ402BVQYiNedCBXH58vOyBIDoTZh8hWj 7DpfC4EQ60KAxG68pGm/vu06GA== X-Google-Smtp-Source: AGHT+IEyiwatpHzojQxJQqleOUfB8ZbwEsU5DLNfoM7+aZ9LaIWvETQTLE36A2blfpoBLiD0LSTAKg== X-Received: by 2002:a17:90a:d505:b0:27c:efe3:89dc with SMTP id t5-20020a17090ad50500b0027cefe389dcmr14429648pju.14.1698305991038; Thu, 26 Oct 2023 00:39:51 -0700 (PDT) Received: from devz1.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id gd22-20020a17090b0fd600b0027dafa55306sm1046795pjb.40.2023.10.26.00.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 00:39:50 -0700 (PDT) From: "wuqiang.matt" To: Jonas Bonn , Stefan Kristiansson , Stafford Horne , Ingo Molnar , "Peter Zijlstra (Intel)" , Andi Shyti , Palmer Dabbelt , Arnd Bergmann , Andrzej Hajda Cc: linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, mattwu@163.com, "wuqiang.matt" Subject: [PATCH 3/3] locking/atomic: openrisc: use generic_cmpxchg[64]_local for arch_cmpxchg[64]_local Date: Thu, 26 Oct 2023 15:39:31 +0800 Message-Id: <20231026073932.702197-1-wuqiang.matt@bytedance.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 arch_cmpxchg[64]_local() are not defined for openrisc. So implement them with generci_cmpxchg[64]_local, advised by Masami Hiramatsu. Closes: https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2 Closes: https://lore.kernel.org/oe-kbuild-all/202310241310.Ir5uukOG-lkp@intel.com Signed-off-by: wuqiang.matt --- arch/openrisc/include/asm/cmpxchg.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/openrisc/include/asm/cmpxchg.h b/arch/openrisc/include/asm/cmpxchg.h index 8ee151c072e4..7d0555257389 100644 --- a/arch/openrisc/include/asm/cmpxchg.h +++ b/arch/openrisc/include/asm/cmpxchg.h @@ -168,4 +168,18 @@ __arch_xchg(volatile void *ptr, unsigned long with, int size) sizeof(*(ptr))); \ }) +/* + * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local + * are atomic with respect to current cpu. + */ +#include + +#define arch_cmpxchg_local(ptr, o, n) ({ \ + (__typeof__(*ptr))__generic_cmpxchg_local((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n), \ + sizeof(*(ptr))); \ +}) +#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) + #endif /* __ASM_OPENRISC_CMPXCHG_H */