From patchwork Wed Oct 19 22:58:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 5916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp575311wrs; Wed, 19 Oct 2022 16:02:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4okxqlqR+nF39EVrHOpx2bWnPt+qI3skj7wnxD4XG8kR6aHZYeAQFL4TpJvo1oCKLbPszp X-Received: by 2002:a05:6402:1e8e:b0:45c:af84:63dd with SMTP id f14-20020a0564021e8e00b0045caf8463ddmr9670912edf.190.1666220546420; Wed, 19 Oct 2022 16:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666220546; cv=none; d=google.com; s=arc-20160816; b=HNYYlgV6+7sHuRJdys1TRPtLHNGhZ59aAtBfMjdgOB0Xt983tzcZarpH35zxHIA+Xf NLbnE3RyZnCQdPOba4l6p5U67JqPcLfTv5BU1BRL1kYNZU2uOSM5UM8MlW2ldEOOJbfz krPI+KseZx9UUex/knpiaFVOdj+09JrVALvaP/zLQvhU6DlIogN5B4kMsDy8b1hFru61 H0C6KOGj6WL7Dw5sCl2UmM9GW2DBd3h0dh5LmBmaFcsYkJs7y4tRnsHIATywAOOdBW3V IlEaDb9ZuIpSrifSW0RQQo+7lZ7LoiTA9HfgVbwXQBAZX5ash0PILy7qnRcKCf5UUMPN QJHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M+08Rpyk7mX+8l1elKiciqp6OQscgdiUIswQxTNpI94=; b=0TmX7ifiYycTIu4mXr/KDIuwyQ3UcfYU7QugzDBehvRxG+J0WEicQOgy+BoytaPanT D88cWGc2RMnVAg6aAD0Vgg2fitw0XJ6Hq7uxpb3oWOL1NTfsV/EX5NADfCqFtjYYcSmx N/yLqV5p7pDNLk2gDpsfLpcXaNag+PpnolXTxtIfIhXElBgXBH9yYiq4mkaSnt2S5bLy 2gzrfSjHhJ9o8bNQdwd1QEEsfaHnpLScEOETIjCOx6o/pxHbuwY9PCNAJ+tG+xqGI4Ca BGRoNP+G75GSDXAwOlL34T6H516mFo+nH3rQf3QX+Gv3W/wCfJ8dMdoU/l1Oz3TLxvSH NgBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VHSeKWao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a50fb09000000b0045fccff0195si617412edq.313.2022.10.19.16.02.00; Wed, 19 Oct 2022 16:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VHSeKWao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231640AbiJSW7J (ORCPT + 99 others); Wed, 19 Oct 2022 18:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbiJSW6x (ORCPT ); Wed, 19 Oct 2022 18:58:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21ACD1CC3EE; Wed, 19 Oct 2022 15:58:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67BB4B8261C; Wed, 19 Oct 2022 22:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B161C4314F; Wed, 19 Oct 2022 22:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666220328; bh=U7EwiwQT1WIRqzav2oy6CKAJs3S0FYOZZwSmr789m/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHSeKWaok+7TErScKygedoM5pxkR28Xt8UhuuCNhxDJHK7bcHWtlUo29Lkc/PrbWb 1b9KpVyaPa/k44ez7NM+GkChSe45i0RD+vtTlIqQ6KxgGj/b9CDGM448AOGXxUYPP2 IplplV+7Up+araeM5uzRfUHNI+bW0O5cMtB1jJs61eMWuWvebcb3m9qoppgC7/igUE SFyASmOxJsO2CWeaTUAm1K8FeIMB3Q3H4IxZD5O/bgLm8gCRPAx8m6ZJH0ml46kKm9 YCAHYFxGInG9rn/bBct8txWus9bYK/kj5LZGBfamSJch5BepTlpx2X4qvil5B1lHMZ hZSCNYcoONwtA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B34FC5C0A04; Wed, 19 Oct 2022 15:58:47 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, rostedt@goodmis.org, "Paul E. McKenney" , Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , John Ogness , Petr Mladek , x86@kernel.org Subject: [PATCH v3 rcu 05/11] arch/x86: Add ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option Date: Wed, 19 Oct 2022 15:58:40 -0700 Message-Id: <20221019225846.2501109-5-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20221019225838.GA2500612@paulmck-ThinkPad-P17-Gen-1> References: <20221019225838.GA2500612@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747158875723990743?= X-GMAIL-MSGID: =?utf-8?q?1747158875723990743?= The x86 architecture uses an add-to-memory instruction to implement this_cpu_add(), which is NMI safe. This means that the old and more-efficient srcu_read_lock() may be used in NMI context, without the need for srcu_read_lock_nmisafe(). Therefore, add the new Kconfig option ARCH_HAS_NMI_SAFE_THIS_CPU_OPS to arch/x86/Kconfig, which will cause NEED_SRCU_NMI_SAFE to be deselected, thus preserving the current srcu_read_lock() behavior. Link: https://lore.kernel.org/all/20220910221947.171557773@linutronix.de/ Signed-off-by: Paul E. McKenney Reviewed-by: Frederic Weisbecker Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: John Ogness Cc: Petr Mladek Cc: --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6d1879ef933a2..bcb3190eaa266 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -81,6 +81,7 @@ config X86 select ARCH_HAS_KCOV if X86_64 select ARCH_HAS_MEM_ENCRYPT select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PMEM_API if X86_64 select ARCH_HAS_PTE_DEVMAP if X86_64