Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B6FEC6FA8E for ; Sat, 25 Feb 2023 17:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbjBYR2j (ORCPT ); Sat, 25 Feb 2023 12:28:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjBYR2h (ORCPT ); Sat, 25 Feb 2023 12:28:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD88C11653; Sat, 25 Feb 2023 09:28:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21F0660B51; Sat, 25 Feb 2023 17:28:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CBB2C433EF; Sat, 25 Feb 2023 17:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677346115; bh=OQY775V7tq8tLvORC1v+ZouMR4NkgEeJqiRqqDQjHKk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UYQdlVogKngmxvP/3HxRVbDMpZjmw8R4UaFy0fZtMwYkonGfTO48sYVSYIZ8xZs9m sfxYvrqldYa1qg1tzHCwwS9bR+3ZAyYtwAHZn7zMlb9pdv05c2VqFIY1TBsXrPWYzt bGlJUTsmy3nMAFn0lxWJrZkv3/s4/FnoMvaDZFgZTNtB7u0IY++87+ANUOue+ldtJ4 +1RokzbkSlPeF0CtNj4xh34oA9EoCVMi1/Vr2qGo8ve3t6Gkau+QOgHVuRUqHZVu/m dhMse7A70f8yLkgrwnfaJazl+8EEZjSOyuBGSiwFjbnWQGfDZspTjpbCzwfQCJBF4x 5+8MwgWK4ZVBA== Date: Sat, 25 Feb 2023 09:28:32 -0800 From: Josh Poimboeuf To: Borislav Petkov Cc: Pawan Gupta , Kim Phillips , x86@kernel.org, Boris Ostrovsky , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Joao Martins , Jonathan Corbet , Konrad Rzeszutek Wilk , Paolo Bonzini , Sean Christopherson , Thomas Gleixner , David Woodhouse , Greg Kroah-Hartman , Juergen Gross , Peter Zijlstra , Tony Luck , Tom Lendacky , Alexey Kardashevskiy , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/CPU/AMD: Make sure EFER[AIBRSE] is set Message-ID: <20230225172832.sqdd7dejkkmjxpt6@treble> References: <20230124163319.2277355-1-kim.phillips@amd.com> <20230124163319.2277355-8-kim.phillips@amd.com> <20230224185257.o3mcmloei5zqu7wa@treble> <20230225000931.wrednfun4jifkqau@treble> <20230225005221.425yahqvxb57c43x@desk> <20230225013202.g7tibykvylprsxs5@treble> 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 Sat, Feb 25, 2023 at 01:21:49PM +0100, Borislav Petkov wrote: > On Fri, Feb 24, 2023 at 05:32:02PM -0800, Josh Poimboeuf wrote: > > > Is it intended to be set regardless of the spectre_v2 mitigation status? > > > > Right, it needs to check spectre_v2_enabled. > > Right, I realized this too this morning, while sleeping, so I made me > a note on the nightstand to fix it... :-) > > > Also, this code might be a better fit in identify_secondary_cpu() with > > the other MSR-writing bug-related code. > > Same path: > > identify_secondary_cpu->identify_cpu->this_cpu->c_init(c)->init_amd > > Plus, it keeps the vendor code where it belongs. All the other "bug" code in identify_secondary_cpu() *is* vendor-specific. And for that matter, so is most of the code in bugs.c. I'm thinking we should just move all this MSR-writing bug-related code into a new cpu_init_bugs() function in bugs.c which can be called by identify_secondary_cpu(). Then we have more "bug" code together and all the local variables/functions like spectre_v2_in_ibrs_mode() can remain local. -- Josh