Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp208357pxj; Fri, 28 May 2021 01:58:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycyyzeMt4+Z/L8VWDOFLMmszIaeYAppd2GSpgq6hOdQfKDuOMBkrEebfuO7S1EKwZTOp+m X-Received: by 2002:a17:906:aec6:: with SMTP id me6mr8030261ejb.522.1622192280731; Fri, 28 May 2021 01:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622192280; cv=none; d=google.com; s=arc-20160816; b=eWcHqGYKPRMzgFiAzPhWi2TRE0YW7/VLZ34GzFwgwhbckDa0nSjib96X7bz1RIBk05 dhA7oBhWhlBXr3GyakIhFQgr+tfPwGNVB7yJa/qOaqJEWTAHAaBN/0sxF19bMCuwWnyj fqnx8D/oMfueg/6iooUoJYj254vetQxp3F41Vy9XMX0bX0EGShQlQI1IG3OYkgVmIyO1 w6JzaGa3LCwr61CO8a7KguMKWYI7c1VhiOCK9U2+nJnhOi+go9O4Eya19vproT8x9E9+ loKVU4fpBZupubv4fnZkvYUctuc71skkgJ/svh8SGIkl6+/1kZK7I/C3QmvqKmCSPCox O/lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nVGCI4tB2+oIhmV2fVTxziePT0APhThyZtPmzEtaXKc=; b=MuCKLo5A/gGxBhtbXMkAKBx6Uj4swpcEgnRunkO/g7dve7BcuHFepMyUzxXF4CyAo9 ntQPaoSFruv5Xl+Oni2/PDgaEmJzu2O0Pu4spX7MoFG6YsAKf2O5xxDWJw8Ov4C3F3fp kM4TO57gg7SyZVdrpRQW+xkv3hZb4nNaB10nF94vZ3BvAdtTiak8QVYLkd13rF5vUKwV 7h2WorBA7maKYpNDVx/c5953PzSs1EDfTJwwtrBMF06jdMm5xMsS95AEN8vLuXbWgbBE kyjDIyW1C+7elf/hrGsE9zYSMEAh/hqjMPSqKFhYRBgvILXHh8c9SnodXzXGYj6N07/A r/8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rav1evEB; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg13si6249566ejc.566.2021.05.28.01.57.37; Fri, 28 May 2021 01:58:00 -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=@gmail.com header.s=20161025 header.b=Rav1evEB; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235072AbhE1GOW (ORCPT + 99 others); Fri, 28 May 2021 02:14:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbhE1GOV (ORCPT ); Fri, 28 May 2021 02:14:21 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED3FC061574; Thu, 27 May 2021 23:12:46 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id y76so3232819oia.6; Thu, 27 May 2021 23:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nVGCI4tB2+oIhmV2fVTxziePT0APhThyZtPmzEtaXKc=; b=Rav1evEBiAikixCNNCjD96VnbkColMfPbR6z5UQhJPsCgFQaNVqPk5sNKa7gxwJaoy z6P1Dg0TDn78Jss4t04KGv5lSKCwLaU1hQ9AmYpoAhLFXQv1BFs88+8pOIznmmcIqiVW qBBVW8xKcb8ixcRqCbc/V1JHfR9xdN0zTy6GrnS2atbgzv2q25IGno8K4ZWEAtQwKUAJ ZYmnZygDxEXI8XcCoHm/Xi8H9+5yKqA0ViN0WrbsEnk3M9IJIrezHqKyhi3RV0Z70U99 IqxzAVHat35jBSjBRgG6Qa5g5YIYiEkCpc8KiZoa3avZVjEWmQgs4a3BNh+okFGbYe4K tqSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nVGCI4tB2+oIhmV2fVTxziePT0APhThyZtPmzEtaXKc=; b=E5iFThJgfguMiyNfP8wXKoiIL0M5SbyWIRkCzwe+U0mAIzgBnexfUTfqUmJLhDp9+5 E67aFRZD9k74+qeeA6F/Ykb6h1p95iyBFnXws0YW3u0lbUuCJId1pcTiWomtLFCpddWh slYS1hWJQ2Sv71HApl8IAA5ZdaK18vO2vTISryu2Pc/ZJWz/V1ti+zQWVJUKvceYG8BC aUVjT4jGx6DqWxWe57Es5a3LvIBkpNE7MjzTCb2f48oI1L2fGlDqRqyFMXxg5UL8OXeM v8knJxFKQJuN2oKVskX12WGi1Pc4WjM5wo0CAogjTNO8cIrA21oOnioez+uXVq8A6HmF CXVA== X-Gm-Message-State: AOAM532eYdu+RnUy8EXoGwwgnYpNWMkk0Ml/F+sD5aLsh958MnB48xEa w1G9NSn1ekfs1D6Dxmn1RK8Q9VpcKUU7A/xRe5c= X-Received: by 2002:aca:4343:: with SMTP id q64mr4865314oia.33.1622182365818; Thu, 27 May 2021 23:12:45 -0700 (PDT) MIME-Version: 1.0 References: <20210527173358.49427-1-jiangshanlai@gmail.com> In-Reply-To: <20210527173358.49427-1-jiangshanlai@gmail.com> From: Wanpeng Li Date: Fri, 28 May 2021 14:12:34 +0800 Message-ID: Subject: Re: [PATCH] KVM: X86: always reset st->preempted in record_steal_time() To: Lai Jiangshan Cc: LKML , Lai Jiangshan , Oliver Upton , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "the arch/x86 maintainers" , "H. Peter Anvin" , Peter Shier , kvm Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 May 2021 at 14:11, Lai Jiangshan wrote: > > From: Lai Jiangshan > > st->preempted needs to be reset in record_steal_time() to clear the > KVM_VCPU_PREEMPTED bit. > > But the commit 66570e966dd9 ("kvm: x86: only provide PV features if > enabled in guest's CPUID") made it cleared conditionally and > KVM_VCPU_PREEMPTED might not be cleared when entering into the guest. > > Also make st->preempted be only read once, so that trace_kvm_pv_tlb_flush() > and kvm_vcpu_flush_tlb_guest() is consistent with same value of st->preempted. > > Cc: Oliver Upton > Fixes: 66570e966dd9 ("kvm: x86: only provide PV features if enabled in guest's CPUID") It has already been fixed by commit 1eff0ada88b48 (KVM: X86: Fix vCPU preempted state from guest's point of view) in kvm/master. Wanpeng