Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp882394rwl; Wed, 12 Apr 2023 05:35:14 -0700 (PDT) X-Google-Smtp-Source: AKy350a3YaXnPIHsSmCEzSASo84vwJOXuO+vh241+bhZuhzL9Bf/zDkUWiANhV5lXTm80Kfwi0H1 X-Received: by 2002:a17:90b:1e53:b0:246:764d:10e9 with SMTP id pi19-20020a17090b1e5300b00246764d10e9mr18668770pjb.6.1681302914360; Wed, 12 Apr 2023 05:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681302914; cv=none; d=google.com; s=arc-20160816; b=CQVIr47noDWr1WFdIMo6SqgO+pK4Que+w38FIyyyAbvt0PLFqCv7CcXTGgE5DK7nrZ MiP1M7pxjOODttgUo1vK0/P3UvOL30oPjtCB9FRN6g/6FjPanorIQ3ZBbwPDGxgUfq7J rst3QWnrdXv4zV6QawPG6LmVd/1joN3R3YkIbU0a1liXngdvFN6c1ojmNOmDc6Yay7tW PVtOdmcnGSIL0pwirux/ASVqJguCpS81sOijIWY6ureHSLavAGmxzBASosaSqSxSUtkx 4Qrf0PKpkGrItkditxuERRdoSBH7HtISWY6f8IchcQMPXT8uldbMrk7m7ZTLkZ33I0/q tlbg== 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=bhnDXdy2VF1lKr1UjNg1V7wUWRoWDZfKo0FUcl+Dhe4=; b=n+gc7dPXBJTDxkOCUzLLpPjdR6IJRIH76MO5dx0nnjiGhmoAKbvWVQqE4slEel2/pU nUaqI07RQubEuAEs+J6yLoIWmL/UA/82qKMS5wV44VhOIh05aZi3Y/p1412Zsjd1cjeE r5EmYO4uyrJi+Cr4QuJwtKjZgK2Fqcius9leNtF8jaFZywfHbB3OJswlTtAPLIio2onW OHjhfjI4pwBmYpvE3mKehU/2RkgEoyTtt7cqgURg6SxBeYMGCjNrkhvpbG1K/Q00SO+B x2thLyu3G9Ohn1ohd3Qq6gV4LjwfflwAq28RNJIhJH9sxxV0seep97cW5bu5vYyaJjV9 XkUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=pxUbpJ5H; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a170902db0100b001a6717fe413si1318989plx.271.2023.04.12.05.35.02; Wed, 12 Apr 2023 05:35:14 -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=@alien8.de header.s=dkim header.b=pxUbpJ5H; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230103AbjDLMbJ (ORCPT + 99 others); Wed, 12 Apr 2023 08:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbjDLMbH (ORCPT ); Wed, 12 Apr 2023 08:31:07 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48DBF6195 for ; Wed, 12 Apr 2023 05:30:50 -0700 (PDT) Received: from zn.tnic (p5de8e687.dip0.t-ipconnect.de [93.232.230.135]) (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 A81891EC068E; Wed, 12 Apr 2023 14:30:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1681302648; 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=bhnDXdy2VF1lKr1UjNg1V7wUWRoWDZfKo0FUcl+Dhe4=; b=pxUbpJ5HSjTrB6f3InyEeJxgNsUJMlH0muOeR8LJnsYU3+TLI9vowfPDWhStcXcgnl5iQ2 rAwuXytWwbxmHzo0bKLfDC5+4+4DI8YLKj+OMx1Cy/0Lund9WD5oinjlMRLgb8p5xYDQGx Pd3IUk6lDmUlWSsj6GhQvFIzy/bfDWw= Date: Wed, 12 Apr 2023 14:30:44 +0200 From: Borislav Petkov To: Juergen Gross Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" Subject: Re: [PATCH v5 08/15] x86/mtrr: have only one set_mtrr() variant Message-ID: <20230412123044.GJZDakdLatRW26J+1k@fat_crate.local> References: <20230401063652.23522-1-jgross@suse.com> <20230401063652.23522-9-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230401063652.23522-9-jgross@suse.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 On Sat, Apr 01, 2023 at 08:36:45AM +0200, Juergen Gross wrote: > Today there are two variants of set_mtrr(): one calling stop_machine() "... two variants which set MTRRs: set_mtrr() and set_mtrr_cpuslocked(), first calling ..." > and one calling stop_machine_cpuslocked(). > > The first one (set_mtrr()) has only one caller, and this caller is > always running with only one CPU online and interrupts being off. Wait, whaaat? It's only caller is mtrr_restore() and that is part of syscorse ops which is registered for "The CPU has no MTRR and seems to not support SMP." Do you mean that, per chance? If you do, please explain that properly in the commit message - this is not a guessing game. By the looks of that syscore thing, it is needed for the very old MTRR implementations which weren't SMP (K6, Centaur, Cyrix etc). Please explain that in the commit message too. It needs to say *why* the transformation you're doing is ok. "this caller is always running with only one CPU online" is not nearly beginning to explain what the situation is. > Remove the first variant completely and replace the call of it with > a call of mtrr_if->set(). > > Rename the second variant set_mtrr_cpuslocked() to set_mtrr() now that > there is only one variant left. Those are visible from the diff itself - you don't need to explain what the patch does but why. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette