Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp601667pxb; Wed, 22 Sep 2021 08:59:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzagsKf7ocosbK5dM5Q8EK5nc6wgjPmen1cy02zTctCE+z9849CKOG+q+HOyvr7vm1ynO5n X-Received: by 2002:a6b:5f1b:: with SMTP id t27mr256472iob.213.1632326370181; Wed, 22 Sep 2021 08:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632326370; cv=none; d=google.com; s=arc-20160816; b=XHI6zwYV+m80O1uCkAgdxxnF6zbT7oHjX6TDUbmCyQDosu0Q9s6cGHFLbzPj/dxgJF 8ItE1kAMBWQazS8AiVbtFtlD91rcebm6hp9No3XgnhDcb/aTW8XuqAE2gov5O06/wDhN zhg1XaOGxFw4YHWag7ChIUuiYlaQTnuINecRozT+dh2h7vBpg93gV+t0tlV+jg2mHr3Y ZJ2R11cXUSw5Z/eJZicH40Ra8gRIBGZNCVHvj0w8wRbvQ32p5d8U8e2NYfH+tkdubmAZ 297LkTXwRrFopIsDlhkCKe7T2igwk4dELEHsrBR2GHDVL3zMMezPOa2nqXSABas5OU5+ xeSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ry9Z69LQArNbVtPmCuRDweOphdtc94L4dVIHpBekN7c=; b=PNYvrqJk4eXER3r2z2aEeigLiS/U/0xwV3hAcRCznA3ilBIgPoLqaxDuTFWEXREdwC EY8ZnPixx0/P1bNl5HQkX9iy2l9nN8FNFHxbH+zdc5GVR79ytweBUFUB2U0koBtGZ0ou x/+EywM8CSWBIhBN8To6t1Nnh3oby00KI41brXz52OesRgzkEP/hjtw8Gzv4Wvdx6sT7 Bura6w4kDl5lOFk2wwfNk/9GwZCbpevc2Q0WkskwUe7Od3FGbX2GpELAUS5Fv+z55gVJ Ir2Z0sX25rWS7TjhrnX+UoHZ2hZ0zEJeGPzMY0C6OB21czfMkkCJ+nLAo7jeP0jJ6Ihv B/5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NCb5G93f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si2908957jao.112.2021.09.22.08.59.19; Wed, 22 Sep 2021 08:59:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NCb5G93f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236540AbhIVP7f (ORCPT + 99 others); Wed, 22 Sep 2021 11:59:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236523AbhIVP7e (ORCPT ); Wed, 22 Sep 2021 11:59:34 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D73EC061574 for ; Wed, 22 Sep 2021 08:58:04 -0700 (PDT) Received: from zn.tnic (p200300ec2f0efa00329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ec:2f0e:fa00:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id BB9641EC051E; Wed, 22 Sep 2021 17:57:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1632326278; h=from:from: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:in-reply-to:in-reply-to: references:references; bh=ry9Z69LQArNbVtPmCuRDweOphdtc94L4dVIHpBekN7c=; b=NCb5G93fgk04Z2kWoYDwBQTP8e5F9qd58TBdUrkNmhNrC8qdF/up7c028VJBvnwal9xUYX Dv0ZbbDkFXiAgYsniyNqarrANQJUFV27++v1GQELTaOcVS5SiGraygAkQnkgP03prqJgCf VbqJxEOAIpJPHVvZCmLnEFCJ2nW3U1I= Date: Wed, 22 Sep 2021 17:57:52 +0200 From: Borislav Petkov To: "Luck, Tony" Cc: Yazen Ghannam , X86 ML , LKML Subject: Re: [PATCH 3/4] x86/mce: Get rid of msr_ops Message-ID: References: <2B1FFC77-A740-41AE-BF8C-FB238B9DF7F5@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 22, 2021 at 03:22:01PM +0000, Luck, Tony wrote: > Also: > > switch (enum) { > actions for every value of that enum > } > > doesn't need a default: option Right, my thought was to catch silly stuff like this here: diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index b355ce737543..dfecf65e5407 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1714,6 +1714,7 @@ static void __mcheck_cpu_init_clear_banks(void) continue; wrmsrl(mca_msr_reg(i, MCA_CTL), b->ctl); wrmsrl(mca_msr_reg(i, MCA_STATUS), 0); + wrmsrl(mca_msr_reg(i, 12), 0); } } but we already warn nicely there: [ 0.146457] unchecked MSR access error: WRMSR to 0x0 (tried to write 0x0000000000000000) at rIP: 0xffffffff8103234b (__mcheck_cpu_init_clear_banks+0x6b/0xe0) [ 0.147550] Call Trace: [ 0.147836] mcheck_cpu_init+0x16c/0x4a0 [ 0.148234] identify_cpu+0x3fe/0x670 [ 0.148607] identify_boot_cpu+0xc/0x94 [ 0.148995] check_bugs+0x26/0xaef [ 0.149353] ? __get_locked_pte+0x14a/0x200 [ 0.149777] start_kernel+0x602/0x621 [ 0.150153] secondary_startup_64_no_verify+0xb0/0xbb and the mce_rd/wrmsrl() wrappers even panic. So default case gone. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette