Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3909234pxy; Mon, 26 Apr 2021 12:45:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvmRRe6DkMQdq6WzVP/QgljEFjIdD41pLXGvjYRXk/FGAyNCYXAfpn9Fqtg1w6/+7o1aEB X-Received: by 2002:a62:3706:0:b029:211:3d70:a55a with SMTP id e6-20020a6237060000b02902113d70a55amr19008586pfa.16.1619466305260; Mon, 26 Apr 2021 12:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619466305; cv=none; d=google.com; s=arc-20160816; b=UgL14oGNydt47UaYhtZWlBzEOJrO0hVJndj9XNlAogRCawKIQ79XNIiPUU12gFK4CJ +hWoJzzA/20yFgwoANRvnNhVhiM2NBdQHh0AJrSCGQLAAAO1KrA/wR1lhnVxNDwK0svi tar/VuTSVhjN+2j3BHiclUjm1j+uR4OBbElbd7kBukCw14YwerlnU++lccd6MoC8cgel 9nAavNiOzCuqEKuuuQ6mL+WT0d9VswwQ5P/BkcAFcnI/F3r995jEWXYQfs7usaj2iDts PXAD/r36dmoJljW1Ui5cRWo0740JZIsY34f6spu+6C9KjmsMEjuM4BHJpn1DU1kvmJWE RFFQ== 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=q7xHJfw/FAhgI41nQLC+0GDChDTWCH6jbZ5uXcC3R7g=; b=c+zBjniznIOTxfphOhNdAjTidWOuo1f6gW4tw/6nxfBOWJMoPj4L+LBOh4soqtcr9L 7VUBQ4rR9Lv9lEGK9GlOHFlvz0UVAAYGPbP39y1tHT/PKSd9BYU88UA4tnLrvsQ5G8Px FxX2zmgDustJOyewwq2sSicfo3DJXJQdH70NpJqsSRXKNImEUXdamzpFl7ygTYjz9Gcn JHHsVPUSWVtJE1DMuzMIjgAXqTmiLDp0ZsM6+5311pcv+V5YuIlmJsgkJ8kPB2NQuEsQ O4/+5JN+hTvAjFfc8vQGbMS0Yu+NefqGkgjqiCi++cX5ial2Uw1cRp3djAKBTU6Ufoj7 pRug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uD57Nba9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si1022136pgf.397.2021.04.26.12.44.51; Mon, 26 Apr 2021 12:45:05 -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=@google.com header.s=20161025 header.b=uD57Nba9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241100AbhDZTpC (ORCPT + 99 others); Mon, 26 Apr 2021 15:45:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241065AbhDZTo5 (ORCPT ); Mon, 26 Apr 2021 15:44:57 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8941C061574 for ; Mon, 26 Apr 2021 12:44:12 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id w20so1849883pge.13 for ; Mon, 26 Apr 2021 12:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q7xHJfw/FAhgI41nQLC+0GDChDTWCH6jbZ5uXcC3R7g=; b=uD57Nba9LUxaDOPNkbfoekPsVIVOiTlq7mL7WjBlh8kgRJ/axmZqfORTOxQoVro8lj 1qWWRxjQoLn4LIabeWCqyATH1tGLzIkFP93h0/KCwe3+lf7J/bNO+gSRvVjc4KubiynV 9whS8Wt1a5TRg4llRu/KD5emff1wMaXZvt0FC1e3xsEHqtU3FieP22PRvWUfvLtuCTCq yDZG2QlYpuT4i4SV17wJ6NjrRZ7nvQUlzLekhq9lZB8E7zspM54nwU5UkTlqyi0tajGW DjuC9MhNXNNuvuGK0kLXf1Jt0ktIb5rgGl7bAUa31PzLXXEfSPV0zy6ja4Xp+tCvcLBb 04cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=q7xHJfw/FAhgI41nQLC+0GDChDTWCH6jbZ5uXcC3R7g=; b=Qc8WcE1ccY54ZFr0qGE6Njl+PnibUaYn+XR+OOmaOTHX6YqB7goYNGk7oW699VpeQI wLRAA51EFr+2XkY60pG8kdYyLwnHPtI1LVNdM0E6Njh4cet9VLCqc3i9CqPxvfUPoXtT LOnXvbu+Ed+E15JOQbup6//R9VnTjuLYJpvEk5giOiCpRo2ldRBUvYp2NHwP4dglXcqB Mk6tGzR6u5rM5ZeN5y+dtgnwLdDixT/MVckCtuSgHTzLBaJJCutefn023FeK1hP3lfHz H3212+XNKjImYUkpLigBZfukN34LAfcGCerRvIAn+3ZTRVG15rouRPIh0+tdC0h3Qt1T 6UhQ== X-Gm-Message-State: AOAM532vEOhC3dwT0N3BpfE3KkTwPPsFjbCLxvqnSp4kuwQpu0+Xcice eip/21vZrBH9HA9qV4dFDI2HJQ== X-Received: by 2002:a63:ce03:: with SMTP id y3mr18095661pgf.414.1619466252386; Mon, 26 Apr 2021 12:44:12 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id x22sm12322889pgx.19.2021.04.26.12.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 12:44:11 -0700 (PDT) Date: Mon, 26 Apr 2021 19:44:08 +0000 From: Sean Christopherson To: Vitaly Kuznetsov Cc: Paolo Bonzini , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Reiji Watanabe Subject: Re: [PATCH v3 2/4] KVM: SVM: Clear MSR_TSC_AUX[63:32] on write Message-ID: References: <20210423223404.3860547-1-seanjc@google.com> <20210423223404.3860547-3-seanjc@google.com> <87k0opfmo9.fsf@vitty.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021, Sean Christopherson wrote: > On Mon, Apr 26, 2021, Vitaly Kuznetsov wrote: > > Actually, shouldn't we just move wrmsrl() here? Assuming we're not sure > > how (and if) upper 32 bits are going to be used, it would probably make > > sense to not write them to the actual MSR... > > Argh. I got too clever in trying to minimize the patch deltas and "broke" this > intermediate patch. Once the user return framework is used, the result of > setting the MSR is checked before setting svm->tsc_aux, i.e. don't set the > virtual state if the real state could not be set. > > I'm very tempted to add yet another patch to this mess to do: > > if (wrmsrl_safe(MSR_TSC_AUX, data)) > return 1; > > svm->tsc_aux = data; > > And then this patch becomes: > > data = (u32)data; > > if (wrmsrl_safe(MSR_TSC_AUX, data)) > return 1; > > svm->tsc_aux = data; > > The above will also make patch 3 cleaner as it will preserve the ordering of > truncating data and the wrmsr. Ah, never mind, Paolo already pushed this to kvm/next with your above fix.