From patchwork Mon Dec 11 09:44:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 17829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6930762vqy; Mon, 11 Dec 2023 01:44:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuMePYei39CUSKrxfMOgCcNiZr0BKs56Aa3Yu2pno4aK5qS8u8iE+oHz2umCB9wMULPqpA X-Received: by 2002:a62:ab14:0:b0:6ce:70ee:8272 with SMTP id p20-20020a62ab14000000b006ce70ee8272mr1548355pff.55.1702287888665; Mon, 11 Dec 2023 01:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702287888; cv=none; d=google.com; s=arc-20160816; b=z9u8HovVsg8sdn7vpPUYzfSC3aZPqrB7aonHQjOkOZRNFcuo+L1/zC6wpcviK02fY0 IPx1uRl1czb3LfXVf1YmGefbJuFeZtuIQPc29Kv+8bEr6XTCCK12aRy9T+2ASQn+UBln 1KNgkeCMW/gU5ijc5qViBtrCJYLlI5kL2fDVhdKBlPucaUPYk8AXF4iFzratXAOLJxkh /VLHtISaA3Z+J7LZyJN5/nUOXRma/5XuVb1AE/gL15CMxIMsRdwK0vGOMRxLoh9TyEjY WVmOfpDE3KeoSrE546+dF5YWKNZ16CyN1x0FFrJCSpKFPoFZrVxjGXhA/uRBVlH/PQo+ EE+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AkVX/kO8wR8tFky0mjPSXH+PwnVI8mpjAOkFM1M+MLk=; fh=6I8UF0n155JlUMKXPHZEdVXaDDfdWw9idVSmXg1+KEE=; b=y9FlhP2JNzVt28uK5C/wxDeMSh3IA8/8YLmA+nb0U9eoKC3TQv2M2Q2TQO9/thsBiA D7pmHiHmaXuZkqAlK9VThgoiOHRrayMgVxcD0ccsHcimCPYMEwmzYgx3nJgzAfYFDo7l GiMFaDDnBllkwE0hduLK4UkcfiWHQuPGo00mSqqnPK6v/9XL+s0CXEinnGxq4MtGVB7T 97IpWekAwA7bUYo2sZznzeztrK20PIIpENNhskCE5ekvffEMxc3K33ZXl8Dha5PeDwJx A7IIA4ppB2qmNTtOx7SMBtQ31GTSMgfn7tDD10cA9oXxlX82EIUX8lZbsRi8z4qboWAZ WG7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kV4gTIcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id o5-20020a635d45000000b005c67dd98afesi5703093pgm.211.2023.12.11.01.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:44:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kV4gTIcE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C200B806156C; Mon, 11 Dec 2023 01:44:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234621AbjLKJo2 (ORCPT + 99 others); Mon, 11 Dec 2023 04:44:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234468AbjLKJoZ (ORCPT ); Mon, 11 Dec 2023 04:44:25 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08ACBE5 for ; Mon, 11 Dec 2023 01:44:28 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c9fe0b5b28so53822071fa.1 for ; Mon, 11 Dec 2023 01:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702287866; x=1702892666; 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=AkVX/kO8wR8tFky0mjPSXH+PwnVI8mpjAOkFM1M+MLk=; b=kV4gTIcEl1J3LFI+Xst4+SECU6vohdQ32uj3LG2Km485KNGX0EAjEmLfI9NUe6EhSw /9uVPzZLGs5PAdF3TMizL2sFp0wMKMbcwxTrvr/Q6OcNUlcChZhJrQ+orAvmZ3IL9lgZ QFyQTzScYpWvGUYV45qc7DyTc63ooCT0Lg5bdKbot1xjVQE9l0oujGcZlsAKNkD3ThpV hLLvBN2/l9ovPxl938SfSof+y/os1dw1nBo0iPMZeQGjdpeKwi8Qo0R75PrevsNHxhy0 rHmChucbPJ3RWVFYhyPzn5c2OgVS9TNNqDXzLcF2Rx4FzIWTuBQ7p/seGUllHlUCF8nQ pxQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702287866; x=1702892666; 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=AkVX/kO8wR8tFky0mjPSXH+PwnVI8mpjAOkFM1M+MLk=; b=AfJaPzvpIpY1jIlCl01Y0TZMVT83tojjGShQFJJ98Xw3mifYkj5BP/cZEEHdwlQcO5 ECPiP818Si6Ii0iwtZsPnOXAc72Q2udqM/qghfEZtWVmQU2B7FrULXmQOs7pO8rbCc+T 5T+IJ9wKAHkLKMWXlBJo0/Chpv8AMIKkTq+DAW4pUSPzgv9zVRXBY7isSJml7/E8Qk7Z eEQILrENAxizHcoOzSZuI6BMc8uWt9tfg2K9eRZBKYCQxiuue010OcaQq/UQ6tr/gj8q RPlUzBrzzs57v+qJw9cjOmjCYpr1GzMC5Q4t1uOOW7pdxmm57rRdczIOvQ+YjScoMDLt y4AQ== X-Gm-Message-State: AOJu0YwUgl5s/l4z8HYUlkbqa23lXqxQmMJmIsgbY21T4AHccqPJNH48 HyAKAaOYeXPWnAZOi/JmaNI= X-Received: by 2002:a05:651c:b09:b0:2ca:68:acf6 with SMTP id b9-20020a05651c0b0900b002ca0068acf6mr1588150ljr.88.1702287865734; Mon, 11 Dec 2023 01:44:25 -0800 (PST) Received: from andrea.wind3.hub ([31.189.124.152]) by smtp.gmail.com with ESMTPSA id if3-20020a0564025d8300b0054afcab0af2sm3463505edb.59.2023.12.11.01.44.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:44:25 -0800 (PST) From: Andrea Parri To: mathieu.desnoyers@efficios.com, paulmck@kernel.org, palmer@dabbelt.com, paul.walmsley@sifive.com, aou@eecs.berkeley.edu Cc: mmaas@google.com, hboehm@google.com, striker@us.ibm.com, charlie@rivosinc.com, rehn@rivosinc.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Andrea Parri Subject: [PATCH v2 0/4] membarrier: riscv: Core serializing command Date: Mon, 11 Dec 2023 10:44:10 +0100 Message-Id: <20231211094414.8078-1-parri.andrea@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 11 Dec 2023 01:44:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784978224990906551 X-GMAIL-MSGID: 1784978224990906551 Changes since v1 ([1]): Add patch 1/4 to resolve the "sync core" scenario reported by Mathieu in [1] and meet the requirement of the membarrier "private expedited" command. Miscellaneous improvements/additions to documentation and MAINTAINERS files. Follow up on Mathieu's suggestion in [1] to introduce a Kconfig /feature for the latter command (patch 4/4). N.B. Patch 4/4 is in RFC-mode, the plan being to submit this patch to the various archs/doc lists (more likely, as a stand-alone patch) once I've got some ack/positive feedback from the MEMBARRIER maintainers. Andrea [1] https://lore.kernel.org/all/20231127103235.28442-1-parri.andrea@gmail.com/ Andrea Parri (4): membarrier: riscv: Add full memory barrier in switch_mm() locking: Introduce prepare_sync_core_cmd() membarrier: riscv: Provide core serializing command membarrier: Introduce Kconfig ARCH_HAS_MEMBARRIER .../membarrier-sync-core/arch-support.txt | 18 ++++++- .../sched/membarrier/arch-support.txt | 50 +++++++++++++++++++ MAINTAINERS | 4 +- arch/alpha/Kconfig | 1 + arch/arc/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + arch/hexagon/Kconfig | 1 + arch/mips/Kconfig | 1 + arch/powerpc/Kconfig | 1 + arch/riscv/Kconfig | 5 ++ arch/riscv/include/asm/membarrier.h | 48 ++++++++++++++++++ arch/riscv/include/asm/sync_core.h | 29 +++++++++++ arch/riscv/mm/context.c | 2 + arch/s390/Kconfig | 1 + arch/sparc/Kconfig | 1 + arch/x86/Kconfig | 1 + include/linux/sync_core.h | 16 +++++- init/Kconfig | 6 +++ kernel/sched/core.c | 9 ++-- kernel/sched/membarrier.c | 16 +++++- 21 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 Documentation/features/sched/membarrier/arch-support.txt create mode 100644 arch/riscv/include/asm/membarrier.h create mode 100644 arch/riscv/include/asm/sync_core.h