From patchwork Wed Oct 19 18:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 5812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp483808wrs; Wed, 19 Oct 2022 11:54:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68SmbgGQSF6puMuIIE4lmqFyfQFf0al2hc0tYirSg/PIszPI5y9kd2qYG+BJdM7nYw5PWm X-Received: by 2002:a05:6402:33c4:b0:448:e63e:4f40 with SMTP id a4-20020a05640233c400b00448e63e4f40mr8768156edc.203.1666205692193; Wed, 19 Oct 2022 11:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666205692; cv=none; d=google.com; s=arc-20160816; b=CKg5tLZeV1ts+2ihWOTbD814hpjBWBJ7h8/F/R65/7qrSBsk3/CuAkHVadbjZdpvXq aTlXvcB3nZMSdYzIuacHNl8ZY6TbHfGPfbR68b1eUOf/ui4wTTMQQUC7y3WBbzkdrJqe 6pBPQES4GIoDUgaP3XHy2NfHmO40kxgIGuFc474tNqMcKwlupcDMaxArVo2KilmXo+lR KgswMAutoi873NuQ9ziv4er8jmR7uegmTHX+Umu9cqg86ZMDlkkvCp81Cj54HjHf5u1M eZY4J+qQkOfTQeZRU5ywsks1SVJdT8iCQt3hijP9mUY0VLw8LrUBoSHEZwsBlhpCFIQo z0AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=yFA++4VjtUU0Ehwjqr3dkN1rspvXDpJNYwm0N7tlHbQ=; b=ZyYgCdwcxQNmwl1buu52G3p3gJjYkBYwl2tQnPbGzWOMu+N13EpgQQVSODiSSVaQFA shUkfcEVHAS5KydL7erspsjNmJXGyOHhXm3DB76DoQ/bp9c1etz1qqPfO+wbY/bP1/S6 cXNU0uLNwu3cvsFPmELlIHjK2KrUF/NcD18JBh4Cx5ZeEP5f5FeODLxCpz4d5Bhfoo8Q hk9AN05zCkS+Q4nNLbZBQb+U8jzkKCRe3mu/hSjtAqaiPptBu+XUcaPXkIft1f/dfR4h 1PZfXk8/kxAmpn+lnBvpKa3LzhGJx/D3h0GIDdl8QPRWYEPX3Lq7Ryw5ph+k3j0fRukP EdJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hWyeEgNn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hZDZREz1; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a170906538800b0073dbc331a40si12353818ejo.188.2022.10.19.11.54.21; Wed, 19 Oct 2022 11:54:52 -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=@linutronix.de header.s=2020 header.b=hWyeEgNn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hZDZREz1; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbiJSSpi (ORCPT + 99 others); Wed, 19 Oct 2022 14:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbiJSSpg (ORCPT ); Wed, 19 Oct 2022 14:45:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0DD61C8D71; Wed, 19 Oct 2022 11:45:34 -0700 (PDT) Date: Wed, 19 Oct 2022 18:45:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666205133; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yFA++4VjtUU0Ehwjqr3dkN1rspvXDpJNYwm0N7tlHbQ=; b=hWyeEgNnWdm2n5VBObK2cH+jPOYLQ8JUbGGblBzEkFilkrhJK/Q/Mj6blCF6LIoHjX/rKj mvQa5gD9foiCJ7o63o0aXeC0XmZHguRG2UShrMMOF1Xkp/jwQkoFWbD2jQw3YeCDrT+8rV eC0O98moupEBMRAWOuRY7/dgMAYo03PJxWU/9eXQhYO/tkKsNEdObBuB9kmJfeFJdDV/// 8sXt2ZPDoN5Axya983CU6A1Ckf+0kdOMkSbrls9JV/s7+W0YdL5zq5phzY8OVs/nliw19F EF/VeHmqpPVVZb/X8Bz3SNI1dEZLfQgZQ4DKmwWdMF/uWn2GGkPWcXZ3oVP+uw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666205133; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yFA++4VjtUU0Ehwjqr3dkN1rspvXDpJNYwm0N7tlHbQ=; b=hZDZREz1rM7sm8eztXA3HIDUr129NReVU7JQlNK/y5WDGzasUcLGdMGVGtdrp4RLT8HCaT auQirb2QAdxiRZAw== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/mtrr: Add comment for set_mtrr_state() serialization Cc: Borislav Petkov , Juergen Gross , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220820092533.29420-2-jgross@suse.com> References: <20220820092533.29420-2-jgross@suse.com> MIME-Version: 1.0 Message-ID: <166620513111.401.160324987040371856.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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?1747143299798693458?= X-GMAIL-MSGID: =?utf-8?q?1747143299798693458?= The following commit has been merged into the x86/cpu branch of tip: Commit-ID: 01c97c7303580682751b5aaae043b639bdcbacb3 Gitweb: https://git.kernel.org/tip/01c97c7303580682751b5aaae043b639bdcbacb3 Author: Juergen Gross AuthorDate: Tue, 04 Oct 2022 10:10:08 +02:00 Committer: Borislav Petkov CommitterDate: Wed, 19 Oct 2022 20:37:23 +02:00 x86/mtrr: Add comment for set_mtrr_state() serialization Add a comment about set_mtrr_state() needing serialization. [ bp: Touchups. ] Suggested-by: Borislav Petkov Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220820092533.29420-2-jgross@suse.com --- arch/x86/kernel/cpu/mtrr/generic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 5581082..c8f8951 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c @@ -684,7 +684,10 @@ static u32 deftype_lo, deftype_hi; /** * set_mtrr_state - Set the MTRR state for this CPU. * - * NOTE: The CPU must already be in a safe state for MTRR changes. + * NOTE: The CPU must already be in a safe state for MTRR changes, including + * measures that only a single CPU can be active in set_mtrr_state() in + * order to not be subject to races for usage of deftype_lo. This is + * accomplished by taking set_atomicity_lock. * RETURNS: 0 if no changes made, else a mask indicating what was changed. */ static unsigned long set_mtrr_state(void)