From owner-freebsd-stable@freebsd.org Mon Feb 8 15:33:31 2021 Return-Path: Delivered-To: freebsd-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44501536EEC for ; Mon, 8 Feb 2021 15:33:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DZ9630hymz3vt7 for ; Mon, 8 Feb 2021 15:33:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 17D50537383; Mon, 8 Feb 2021 15:33:31 +0000 (UTC) Delivered-To: stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17A1A536EEB for ; Mon, 8 Feb 2021 15:33:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DZ9625LkFz3vjJ; Mon, 8 Feb 2021 15:33:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 118FXM64004684 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 8 Feb 2021 17:33:25 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 118FXM64004684 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 118FXMW1004683; Mon, 8 Feb 2021 17:33:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 8 Feb 2021 17:33:22 +0200 From: Konstantin Belousov To: Mark Johnston Cc: Alan Somers , Matthew Macy , FreeBSD Stable ML Subject: Re: Page fault in _mca_init during startup Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DZ9625LkFz3vjJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2021 15:33:31 -0000 On Mon, Feb 08, 2021 at 10:03:59AM -0500, Mark Johnston wrote: > On Mon, Feb 08, 2021 at 12:18:12AM +0200, Konstantin Belousov wrote: > > On Sun, Feb 07, 2021 at 02:33:11PM -0700, Alan Somers wrote: > > > Upgrading the BIOS fixed the problem, by clearing the MCG_CMCI_P bit on all > > > processors. I don't have strong opinions about whether we should commit > > > kib's patch too. Kib, what do you think? > > > > The patch causes some memory over-use. > > > > If this issue is not too widely experienced, I prefer to not commit the patch. > > Couldn't we short-circuit cmci_monitor() if the BSP did not allocate > anything? > > diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c > index 03100e77d45..0619a41b128 100644 > --- a/sys/x86/x86/mca.c > +++ b/sys/x86/x86/mca.c > @@ -1070,6 +1070,13 @@ cmci_monitor(int i) > > KASSERT(i < mca_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid))); > > + /* > + * It is possible for some APs to report CMCI support even if the BSP > + * does not, apparently due to a BIOS bug. > + */ > + if (cmc_state == NULL) > + return; > + > ctl = rdmsr(MSR_MC_CTL2(i)); > if (ctl & MC_CTL2_CMCI_EN) > /* Already monitored by another CPU. */ > @@ -1114,6 +1121,10 @@ cmci_resume(int i) > > KASSERT(i < mca_banks, ("CPU %d has more MC banks", PCPU_GET(cpuid))); > > + /* See cmci_monitor(). */ > + if (cmc_state == NULL) > + return; > + > /* Ignore banks not monitored by this CPU. */ > if (!(PCPU_GET(cmci_mask) & 1 << i)) > return; I think something should be printed in this case, at least once. I believe printf() already works, because spin locks do.