Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp947609rwb; Fri, 18 Nov 2022 10:19:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf4JPg5FdTGRHmvUfdQ50bDSwBDwsqnQnM1C7l4E89w3Wds9Y5uMoXuGCE24oPE1xXxJWXe2 X-Received: by 2002:a17:90a:9d89:b0:213:2704:1d1 with SMTP id k9-20020a17090a9d8900b00213270401d1mr9070756pjp.45.1668795589813; Fri, 18 Nov 2022 10:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668795589; cv=none; d=google.com; s=arc-20160816; b=jlDhN/v+tropouLB8t5IreX7zUZLM2i5dot2QaK2fYbqArabSMTiL2T6OL0a4Yyh63 8o9UaqxPWtP0jKO2Re2svTsdlRZwrFBJ66l3Q1kO8ByZAQlvyung267T4CuLcRIrPwJw xlUQyYiWVUkES8stBaITHTPz8vnbmfzJj9j0v9WV5bjymL5pw68VWKKuWAuCU19qyjnV ZheUKdDLysjykcKWJMrzt+5ubh1oo50Z19wY4soaeAOVwrlfnsK75jDki3d1NvbFxfmq 4+a0xN5LslWInOhXs46oZY0Jdzigt+5M0O8UIGEF7fKktf+VrGrBvRTimfyYM+zcG90e oxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=p74YoEb6J9BKFjpG6MDmdd3TrfhbjqSdR1mt3ULhQ54=; b=gVpg9QvSUSZU++CExn3+KRFC3cPMPCAEdwun85AkmQHfYLkjisC3bd2PAGXvjf5ONo w+iZ5HMqNytWaBrCD5CQkHIMmOcZpFwpOzGOHZT3LF1PIRas8/YeqJJahV7eoSCxOdkJ Ph5UfbD4Pbq+ZDIqUVeyMbuIG7P7ef2ZT2w1XIfnwdhFzFtqvOdHVt+B5BzYXzkLraTr IQG0BhBNU5s5Ciqf5/Th5PSnqs3KHu7fPbl2/fZTOzgYRMMKn2lM+iusuNRkPqiGQ5p7 J3+gPWn/iUftrWMLmDvgVvmneuxcZuQC5U6GS97bEfiAOy8RuK8bLO/GVu0z8VTgJxBG h1qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LMSXzJRC; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n19-20020a635913000000b0046ec381a28bsi4468661pgb.25.2022.11.18.10.19.37; Fri, 18 Nov 2022 10:19:49 -0800 (PST) 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=@intel.com header.s=Intel header.b=LMSXzJRC; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242530AbiKRSMi (ORCPT + 90 others); Fri, 18 Nov 2022 13:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234447AbiKRSMh (ORCPT ); Fri, 18 Nov 2022 13:12:37 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19B7C5D; Fri, 18 Nov 2022 10:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668795155; x=1700331155; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=a5XYRuFsTWq7kic2uFkZnRtD13iqt4AWhF3B29PLMp4=; b=LMSXzJRCpRkq9JXWwSHID5d6LqNAs1HYDLXA62D/gof2wAMMZn4wZ2aY p5iBdGEQxtMFWlX4AluuDkaqR9E+nj6Yupk4Tell5l1gjwlnQgK/j3say x5bm46jJWto31MAxe7MaOgNpiZlNbs3770Yy5Dytec5ifoGFa5xNUWWzi +z1gIMXFdSj4DJhFeEpMG2XZFdqERCLup3BPtWaiho3F4WoqlpflxOmeL nunxlq2MhsCUQmumGcb6wwLAZanVZ0cLQGJfX6YyiQRaKkMSgv6cT50Fx ISP+Aa+Ky28eMwzqytieWKvgr+lBCRIVBRuaHbXsKcoXgtHnzEUEyATl+ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10535"; a="340041947" X-IronPort-AV: E=Sophos;i="5.96,175,1665471600"; d="scan'208";a="340041947" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 10:12:35 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10535"; a="969361944" X-IronPort-AV: E=Sophos;i="5.96,175,1665471600"; d="scan'208";a="969361944" Received: from mbeebe-mobl1.amr.corp.intel.com (HELO [10.209.82.240]) ([10.209.82.240]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Nov 2022 10:12:32 -0800 Message-ID: Date: Fri, 18 Nov 2022 10:12:32 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v3 2/2] x86/pm: Add enumeration check before spec MSRs save/restore setup Content-Language: en-US To: Pawan Gupta , Andrew Cooper , thomas.lendacky@amd.com, "H. Peter Anvin" , hdegoede@redhat.com, Ingo Molnar , "Rafael J. Wysocki" , Thomas Gleixner , x86@kernel.org, Pavel Machek , Dave Hansen , David.Kaplan@amd.com, Borislav Petkov Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com References: From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE 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 11/15/22 11:17, Pawan Gupta wrote: > To fix this, add the corresponding X86_FEATURE bit for each MSR. Avoid > trying to manipulate the MSR when the feature bit is clear. This > required adding a X86_FEATURE bit for MSRs that do not have one already, > but it's a small price to pay. > > Fixes: 73924ec4d560 ("x86/pm: Save the MSR validity status at context setup") > Reported-by: Hans de Goede > Signed-off-by: Pawan Gupta > Cc: stable@kernel.org Thanks for fixing this up. The X86_FEATURE approach is a good one. The "poking at random MSRs" always seemed a bit wonky. Reviewed-by: Dave Hansen