Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp3764049rwn; Sat, 10 Sep 2022 20:23:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR7rGHGLmMOQ4bVYYVUNDppDFB/ZgYqotVE3dNb1y1s32pLfcejsP9E2w0B8iI0gEf1SQ01a X-Received: by 2002:a17:907:8a04:b0:77c:398c:90fa with SMTP id sc4-20020a1709078a0400b0077c398c90famr1614085ejc.595.1662866601770; Sat, 10 Sep 2022 20:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662866601; cv=none; d=google.com; s=arc-20160816; b=JJe44gOCQ3NrBSs2zpHGaDsB6543jr9X1ZoU/1hERXcYDBR7yGtiAdzVRVD9bgk0YV dUsmvcxQKdyBANJJSA775bxuhkPKIP8ZQ3/oTy5f7sSW/l0H+fyoFnUI7LhA4/oBqo1E SeV00vvg859QY8seQbODrH1aHgbDWS4oFBbljerk5RR+L2KFfVYVGmyyVVe0OvvP4n1a YQuACLjyHnyeNu67aapXQzyF/7lxn5ri+mMq76tG0kQaRhXsA258CDLlEdRAurwROZc4 XkoQypwSugEPBB84u85zSQQg0qbu9I8XihmoqiAtE/+/Zw0MowZDsmUe/zaAdL5FBdJn C8AA== 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=YW6q0Ug4ODiNiFnU1n7bDTn4AUEnHpnmoBlpOQHBlK4=; b=uXUd2dBuKE7+BFACSkZlbvbGC5ZCxAvvXYLbdzCD5BtPT4qxm+Z8O9xhdE3C1iquc3 5YU1l/xynv2RLzhJ9ueJwLRhA37xtLd04H/MEAPePuuhUMSWOo0X937YEHcn01inW7RY RIiNLLxZ+l1b2LHQCdjha/jnZ9QMBuv5t87oZmH8ssm1qXDgswL4a1lfTle+36Tt0Qwy 69AZh0ExsfBuADPmp1JvZb+VwUO2PabBObZLYO9mb6eu+4jACPXSVtSVVR78xjI9cb0k CrdDYxbefnzeeYzNeLlKQoKFuu+j4o2NiEbew9eroK4zjlPJmxBSpZUC82PDir3GEdDs SUzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lpXap2QJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170906775500b0074145082ee4si1690548ejn.899.2022.09.10.20.22.52; Sat, 10 Sep 2022 20:23:21 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=lpXap2QJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbiIKCpv (ORCPT + 99 others); Sat, 10 Sep 2022 22:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiIKCpt (ORCPT ); Sat, 10 Sep 2022 22:45:49 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B359233A29; Sat, 10 Sep 2022 19:45:47 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id z9-20020a17090a468900b001ffff693b27so5094983pjf.2; Sat, 10 Sep 2022 19:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=YW6q0Ug4ODiNiFnU1n7bDTn4AUEnHpnmoBlpOQHBlK4=; b=lpXap2QJQyEtvavrHCYA61PbWKVZ7IC/5tX6/2oVZZHZWa6VrqtvLoPwrHXDY3T3y/ iD7D0qeR1mW3s4wbeARntYA7Wdbi0zhXh2eV4qJyPoI0ifOTADIcxy1iAWECoz8lnspx OClbzNUQgQBLOmlhaHlVj7cnPIfeS7ZgEe1ikTwXVVpuW+ZH3jOpAApPzRoSOZR4MN7L naSHKlFVRXohHyLkMGdnPY5QZOUaToUNqXKYVNM0UVUW5Mb80RMf0QlAOIAMaEsCy9AY MBd2w7wXN6jkUkFR6waSkUgIOxIA4Z0+nTJxT3JdPqsmAbh7+IXeITlIyC3c5dFS8d+C yDNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=YW6q0Ug4ODiNiFnU1n7bDTn4AUEnHpnmoBlpOQHBlK4=; b=7EHyu8OgwqVNeaDhyLX5SjgmPOp32GvslyPe4p47AijsrWVHN7N5zhEjE+1MWbj1HI iaSRYk3+hMOW/JVGzALuzvVk5181TnUKdjym5+G4pDw4H2jaJ1nC8bWXbQr+pfT8kt4c KmtOrn4BZoGhHsgRCtMgIDdxnErVfkqZM2n78L89hJnhUbg4oIjyQm86AyVi+nrkTYeJ kJxERn7+DSogsU84N7jghtGvhnsj/1uPNVhvmnb62YqsMHCpqO0o99kxqRKZqxCUAQoq OXa5pCQWK6MBO0kHDdY7F2Vl2Th1nq0Fgf+1jzzRNTY2+MPwhkC0ipG+d3wnq1ut8bfd D4ig== X-Gm-Message-State: ACgBeo1OH3LgMkhcrjbWFRgTqOHyDuIYPFdW1iuau+M22UxM33uhrxzo gqiekViRDBW1xDRn6Z5sKqc= X-Received: by 2002:a17:90a:bd12:b0:200:5112:3167 with SMTP id y18-20020a17090abd1200b0020051123167mr17142319pjr.109.1662864347152; Sat, 10 Sep 2022 19:45:47 -0700 (PDT) Received: from localhost ([192.55.55.56]) by smtp.gmail.com with ESMTPSA id mp17-20020a17090b191100b001f94d25bfabsm2683851pjb.28.2022.09.10.19.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Sep 2022 19:45:46 -0700 (PDT) Date: Sat, 10 Sep 2022 19:45:45 -0700 From: Isaku Yamahata To: Chao Gao Cc: isaku.yamahata@intel.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Will Deacon , Yuan Yao , isaku.yamahata@gmail.com, Kai Huang , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen Subject: Re: [PATCH v4 12/26] KVM: x86: Move TSC fixup logic to KVM arch resume callback Message-ID: <20220911024545.GE699006@ls.amr.corp.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Fri, Sep 09, 2022 at 01:48:32PM +0800, Chao Gao wrote: > On Thu, Sep 08, 2022 at 04:25:28PM -0700, isaku.yamahata@intel.com wrote: > >From: Isaku Yamahata > > > >commit 0dd6a6edb012 ("KVM: Dont mark TSC unstable due to S4 suspend") made > >use of kvm_arch_hardware_enable() callback to detect that TSC goes backward > >due to S4 suspend. It has to check it only when resuming from S4. Not > >every time virtualization hardware ennoblement. Move the logic to > >kvm_arch_resume() callback. > > IIUC, kvm_arch_resume() is called on the first CPU waking up from suspension. > But the detection was done on every CPU. Is it a problem (i.e., we fail to > detect TSC goes backward on some CPUs)? The problem is, TSC fixup logic is only needed once on resuming. The current code calls TSC fixup logic on each cpu onlining. It's quick plumbing the logic to each cpu online. Although it won't harm to call the logic, it's ugly and this time is good occasion to clean it up. I will clarify the commit message. -- Isaku Yamahata