Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1143724rdb; Fri, 1 Dec 2023 08:05:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/kH8WiN6p0hY+mLzFtVMgc496pvjODE82DWHXMovaABYLk/3ZvfYO0LFBeXp4Xhc4oMM3 X-Received: by 2002:a17:90b:4b0e:b0:285:a273:6822 with SMTP id lx14-20020a17090b4b0e00b00285a2736822mr28238016pjb.6.1701446735837; Fri, 01 Dec 2023 08:05:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701446735; cv=none; d=google.com; s=arc-20160816; b=I/jYFt/SuvRrK4H9YE8Rt/tceSu442x6QE2/oI9DdybJhmHvu9BxSRuvRZRVNVsCOf KIgDItNpDaIzdbRw6gxi6fo/1Do1byy5zQ8JsxRTke/9oDrXXWED520s6aRrSTCTpXeB YKIYdNgt60/9+Uo0JWOcczWvGN9f9kOb7zNiVaWvnHkDn1ucYcyXm4Ez8XFoTEF1cV95 hJFEFqrFUYKivy1oeV6b78o5NfgwGuEtkUhwhaz+4sJra4kNGZ3da7hnAh4QaMzReNQ0 XWg/IHFL7KPd3rvEj7hKFEzDmy7idG303LmiCG5dkCsZ743ztPbBIKqQCoP7EQ0c6MTl DnbQ== 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:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=6uUVFw257k+oetJtub1L3S2+w6adIuqq8TGHjPH/2y4=; fh=V/BdE3enU1vBU8+jg67+S9lupskizZDs4gNFzbLXbcA=; b=MpPFTM+ha2WP3Y+hceq6KYipcjHQZhUymoh1JwhyXsBsAo/mdyDGGQMEwqoeWY4tpR 339mOtFhlePtcKIORUSvJFOXp5Y2bvn0yjBqjkV32l6P6ULkfX1sl74uADnYed+oKijJ 11rv6RG15/Iz6mzdkvZRuHGCuhVOJfP6EkEXc4TRKAewV2OdWp/5kVJO2AKCLlM+sqjn XziS9eZTAXh8WWJSyBkJz/D1M6A2/55a50TIN2iVPK8X6Nd5QVHmlzLnefYuSNtEIVsg 6B5A6DTxBqokDYfo0UL/5//9SytCwYw2DV10+W9tD8/XBpN7HJSy7zH/pTUps5xU1wKf vK7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ot13-20020a17090b3b4d00b002839e1cb23csi6297566pjb.117.2023.12.01.08.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:05:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 649DA811F132; Fri, 1 Dec 2023 08:05:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378625AbjLAQFD (ORCPT + 99 others); Fri, 1 Dec 2023 11:05:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378536AbjLAQE6 (ORCPT ); Fri, 1 Dec 2023 11:04:58 -0500 Received: from vps-vb.mhejs.net (vps-vb.mhejs.net [37.28.154.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B803C10D0; Fri, 1 Dec 2023 08:05:03 -0800 (PST) Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r960h-0003eb-QO; Fri, 01 Dec 2023 17:04:59 +0100 Message-ID: <00fa768e-eceb-48c3-ae23-1966f110ec49@maciej.szmigiero.name> Date: Fri, 1 Dec 2023 17:04:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] KVM: x86: Allow XSAVES on CPUs where host doesn't use it due to an errata Content-Language: en-US, pl-PL To: Jim Mattson Cc: Maxim Levitsky , Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <9a8e3cb95f3e1a69092746668f9643a25723c522.camel@redhat.com> From: "Maciej S. Szmigiero" Autocrypt: addr=mail@maciej.szmigiero.name; keydata= xsFNBFpGusUBEADXUMM2t7y9sHhI79+2QUnDdpauIBjZDukPZArwD+sDlx5P+jxaZ13XjUQc 6oJdk+jpvKiyzlbKqlDtw/Y2Ob24tg1g/zvkHn8AVUwX+ZWWewSZ0vcwp7u/LvA+w2nJbIL1 N0/QUUdmxfkWTHhNqgkNX5hEmYqhwUPozFR0zblfD/6+XFR7VM9yT0fZPLqYLNOmGfqAXlxY m8nWmi+lxkd/PYqQQwOq6GQwxjRFEvSc09m/YPYo9hxh7a6s8hAP88YOf2PD8oBB1r5E7KGb Fv10Qss4CU/3zaiyRTExWwOJnTQdzSbtnM3S8/ZO/sL0FY/b4VLtlZzERAraxHdnPn8GgxYk oPtAqoyf52RkCabL9dsXPWYQjkwG8WEUPScHDy8Uoo6imQujshG23A99iPuXcWc/5ld9mIo/ Ee7kN50MOXwS4vCJSv0cMkVhh77CmGUv5++E/rPcbXPLTPeRVy6SHgdDhIj7elmx2Lgo0cyh uyxyBKSuzPvb61nh5EKAGL7kPqflNw7LJkInzHqKHDNu57rVuCHEx4yxcKNB4pdE2Sgy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n7rOB7udmTmYb8nnlQb 0fpPzYGBzK7zWIzFotuS5x1PzLYhZQFkfegyAaxys2joryhI6YNFo+BHYTfamOVfFi8QFQL5 5ZSOo27q/Ox95rwuC/n+PoJxBfqU36XBi886VV4LxuGZ8kfy0qDpL5neYtkC9w== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:05:16 -0800 (PST) On 1.12.2023 00:57, Jim Mattson wrote: > On Thu, Nov 30, 2023 at 2:00 PM Maciej S. Szmigiero > wrote: >> I think that if particular guest would work on bare metal it should >> work on "-cpu host" too - no tinkering should be required for such >> basic functionality as being able to successfully finish booting. > > I disagree. Let's not focus on one particular erratum. If, for > whatever reason, the host kernel is booted with "noxsaves," I don't > think KVM should allow a guest to bypass that directive. Good point, I agree that if user explicitly disabled XSAVES on the host via this parameter then it should remain disabled for the whole host kernel, including KVM. This could be achieved by either adding special "noxsaves" flag or by setting X86_BUG_XSAVES_AVOID instead of clearing X86_FEATURE_XSAVES on these CPUs. Then the core kernel XSAVES code would check for lack of X86_BUG_XSAVES_AVOID (in addition to checking for presence of X86_FEATURE_XSAVES) while KVM would keep using only X86_FEATURE_XSAVES. Thanks, Maciej