From owner-freebsd-stable@freebsd.org Mon Feb 8 15:04:03 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 F2BD6535F5F for ; Mon, 8 Feb 2021 15:04:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DZ8S35b2sz3sF5 for ; Mon, 8 Feb 2021 15:04:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id BFAD953640C; Mon, 8 Feb 2021 15:04:03 +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 BF774535F5E for ; Mon, 8 Feb 2021 15:04:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DZ8S34f9Kz3sF4; Mon, 8 Feb 2021 15:04:03 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qv1-xf2d.google.com with SMTP id f18so916448qvm.9; Mon, 08 Feb 2021 07:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MOJ1RzGyUiBAIg08KAILzPbBxi/tu/8QVyQBqj/AlBs=; b=HiHEMybnY8RhgFWSxXo1gQznDkAULrUSUrsFyzXeQNoxvP6lFi6KXcmZMxqZHrW2Kc wRk3xbLg6eBxgTSXgggiEtEdg/jGW0bRHlOGkRrIiob8bJcXUuq5XqfyhfGwUsQ5VHMi VPIrFDprlzDNHRiw5JbOToAeHRmJ/+oTjQJq18alAwJbd/2wYUyUy99zg5mn/LjLzSk3 czvYwHQSE6UX37reQN+52FI1SaVUHlE5MnIZAobV4vdpm5Hvx1jC94qyW8Cwc7aCKqaA wECK3MYoJpz6G9D1Mu42XEeldln7ORfxz8jDQf/yUx+ycKIwHlUQ50mtMegcG7a1FvYE 3KJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=MOJ1RzGyUiBAIg08KAILzPbBxi/tu/8QVyQBqj/AlBs=; b=bqTJkehekxF9NFfr6cw6dCaqHSltclfSbndDn9cPTELSicvdVnm/uVqluhUk981eVq 9UQpr9B2N+isQursUx4bNSjxG7U+vlJM77qHmQfaOWbdI5YAjNUnLwvoa8sY/f61BUIE NLG1juHzDv2g9x9svAskavRmN2UeS+il3HONUDtMP9itL/JbUJncxiV4ThT9oqokMCbY ESo1zb3I+UWV2cVgxzHe9rD6+v06ec7ygh8RWH5hwKV3Bj5++n4Nup5E56vPiKfM6Qab 6LvQo0L+dH/zLRaWM7w23294S/hQCseUUjSiXQbXWFieH3Z8zbE9FUrVSyIbrLq2ukP6 +CLQ== X-Gm-Message-State: AOAM530ltKLj1iODEwJk/5p6TMQfzf8wJvwTbomTkgEN6Gc7FDrIeNDd YIVgnXp21skyNJbaomRDs9U= X-Google-Smtp-Source: ABdhPJz6hO+DIewZ3FUZFEm9L74BKmgqIwe/6uWPyyILUbkOZpYMhwNDmw19BSiPW90kqF1QXC8mgw== X-Received: by 2002:a05:6214:d66:: with SMTP id 6mr16056922qvs.7.1612796642860; Mon, 08 Feb 2021 07:04:02 -0800 (PST) Received: from raichu ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id t8sm15864564qkt.125.2021.02.08.07.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 07:04:01 -0800 (PST) Sender: Mark Johnston Date: Mon, 8 Feb 2021 10:03:59 -0500 From: Mark Johnston To: Konstantin Belousov 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-Rspamd-Queue-Id: 4DZ8S34f9Kz3sF4 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:04:04 -0000 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;