Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3677294pxj; Mon, 7 Jun 2021 17:38:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN0xpIfcD6mx3if0ANDGXNrZ/yVbQycOu8+6vxyPYo7+WBaNv3cV0JgGL0rB4eszyfsq0Z X-Received: by 2002:aa7:dd4f:: with SMTP id o15mr23093800edw.174.1623112734721; Mon, 07 Jun 2021 17:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623112734; cv=none; d=google.com; s=arc-20160816; b=C0C94H2BiIFo2Qtfa0eQnr9TGWiuDnTzUQhqeuJ5GeC41Ab/dDjHDL1a2lQ7Bap9iJ lCJg0hrhLFnNVLJSPkyJTVUxGs8i2BJD0pRo0Z8dlg9w89dkx5jAQUDOZRKYLRoGBnwm NzIz0dpegqKXjrYTfMI4u9VslW51iEgF3Dhus/syx5R8tAGPdwy4ZdLXMZVcCqWzFAYe BPy53cGn/kV+O8MrmvLg3yVvSxsW5n7yWNex9jSuAU7ZYRKBylhfhEWrHcX5WmyBoLFe xoQrrbE30j95siLQJQGBqpko654jLzCx0NGeo9jU9daDN8MzOkciihX7zPhYhohgJQaI PMgw== 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=VjYZkdAh6XPRWdRICkFVqrEq2Tj+cpaidhfkOKHJ4Ys=; b=KZpIELrXu3ikUtXf8zOMadJ/mH/RaT8bffXWTeF4zfog04cbqCu9a2NZeR34ReiuRm N0P4+AsdDjgI9CwVyuuEPhPCDTdk66XfSDm+y1MFn1TBPEAaolREXplaOrdMYeko9Uz4 R3EX0qd301WfJq0ajOaG/ZXJRBiM3eK4P6SIEjiAc4Tt/BJ1Q4dgALr4bEQUVaeRCXSP CkIuIw9oF2i0Y53VZakIOAM2o7TKfLXnLFR4l2KkubickiuZQaNga5MMjmIUVFnwjcv9 bZOvswS8DaQh0uN42upDEZbvihYvnHqlbJ7gvuD8JwVRbsDpqymjT5bXl2v1SOuFsuDQ CzJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VxDpUN2Y; 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 i16si14123814ejg.401.2021.06.07.17.38.31; Mon, 07 Jun 2021 17:38:54 -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=VxDpUN2Y; 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 S230494AbhFHAgv (ORCPT + 99 others); Mon, 7 Jun 2021 20:36:51 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:40636 "EHLO mail-pl1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbhFHAgv (ORCPT ); Mon, 7 Jun 2021 20:36:51 -0400 Received: by mail-pl1-f182.google.com with SMTP id e7so9667319plj.7 for ; Mon, 07 Jun 2021 17:34:59 -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=VjYZkdAh6XPRWdRICkFVqrEq2Tj+cpaidhfkOKHJ4Ys=; b=VxDpUN2YqnA3P9FRBWtKzfkmPb7dN1ye0DLknStv0JLAD0lfAYJiloty4u2A2nLkC2 pGtWItn3Gvk4OP+7W0gKfvq98YmCnreZ6G/AZanLijfQNUOgVlrZ57WL8DFZXizrrFVy pmUSWL5JCCSY4etvrLNznIf4K9hXQGkpCBFTVTI4XOMiUB/Joal4/q8VPtGA9Ih4BiOS EGSFYbQ82tzTIw30T6l7qvgwYlkqNJqFbJ27IJ0ytbAqLkt0vhbwxiEl8wqEmw5Lt4U0 wUXZq1UWdi9HNXQISzwxdhUUp292917s71LULkIm/re9u/Z/7gCBLrDa+fqdIoRIgynB K5fw== 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=VjYZkdAh6XPRWdRICkFVqrEq2Tj+cpaidhfkOKHJ4Ys=; b=Xu5MWOi1rmHM6w7xDD64V/R44P9/hudg6mbSmuxyr/vPzVOUURXFRqoR3SJW9kWBfo 2hXZzRk/wXlsWbbt6r60odfP7xpyQt9AmhSJnY1eyCmMtgSypxAM+VSetrQylZ7medUH tSzfhv8hUaaXF4F4F0fG2Fi1CmRyYrsyTe5JoDIFcH46GKMnPQVjYs9rARCtL2KQdJVy CeOr4BHE7E1zx1DEc59tdB+R5O+Gpab1A4qfVkujOdf//a4R/ufhvQLumD9tF48shmOn uW/yAy28md/4p2lApYnPSLsQlCdtHXQUY3bysH4RnZrwMTARC9BI730PzA+NPBNMpz/k gnZQ== X-Gm-Message-State: AOAM53025oG3LFet9Rhlmpjs7T5NlPgBl4ahVozrL1QQKqRVg5FNARKG 2kDlOxj3CJjl7ifpHf7xkxrLfg== X-Received: by 2002:a17:90a:7f85:: with SMTP id m5mr23359411pjl.128.1623112438897; Mon, 07 Jun 2021 17:33:58 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id t19sm490189pjq.44.2021.06.07.17.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 17:33:58 -0700 (PDT) Date: Tue, 8 Jun 2021 00:33:54 +0000 From: Sean Christopherson To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Lai Jiangshan , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org Subject: Re: [PATCH] KVM: X86: reset and read st->preempted in atomic way Message-ID: References: <20210531174628.10265-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210531174628.10265-1-jiangshanlai@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nit: the shortlog is somewhat inaccurate now, maybe just: KVM: x86: Ensure PV TLB flush tracepoint reflects KVM behavior or something along those lines. Not sure what the best wording is :-/ On Tue, Jun 01, 2021, Lai Jiangshan wrote: > From: Lai Jiangshan > > In record_steal_time(), st->preempted is read twice, and > trace_kvm_pv_tlb_flush() might output result inconsistent if > kvm_vcpu_flush_tlb_guest() see a different st->preempted later. > > It is a very trivial problem and hardly has actual harm and can be > avoided by reseting and reading st->preempted in atomic way via xchg(). > > Signed-off-by: Lai Jiangshan I saw this quirk too, but couldn't quite bring myself to care enought to test a patch :-) Reviewed-by: Sean Christopherson