Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4692758imm; Mon, 17 Sep 2018 19:56:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbDKr5nRrgy6QNf4KCtfuFa0sceUlOeozShnp54HVHU4YHYO9U7soNbxMqWRASxBWfAF+Ab X-Received: by 2002:a62:46c8:: with SMTP id o69-v6mr28765243pfi.21.1537239402482; Mon, 17 Sep 2018 19:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537239402; cv=none; d=google.com; s=arc-20160816; b=LuYT7Shg5Dh+TyujHa4AFhpWKL/vJTcIQrKzTrRt1GznwKOpbP3eznu71Ioupq7+UR bwd4gv9hoRpLXW/w34QWBbHGDbF8/azJndJoPLcuWajcaAQkM8LfLMh0s7XGcSii5nqI fZPCHiuxZX8xO3UggJpipLMrcoZU1yWxj6/Z1oLZasPul0Mp+J0psQPb6s6rFlmCJ4Ev RxHwkgneiYx3qt9OKOrFuFB544c7hc4b6M7/ecWcCEr9i2+UvtdHVzA+ATdE00yOupcS g6P6+KbBPWNqHuduFL0xkC8qlB4DfT9WxsO02SbpimPSywlbALJLqOw4NZJlEWeuia9A CrJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fBvCZvNybDPnvGkQdi8baITljD2xcwCiLI6SscnDDsE=; b=KS3amo9NUY4fXYPqG4Rw+1j6K1MM9Lv9kaFJAl+VZfY+8DpXgPS4Nbo39wO5kup1OD 2kXydSYBGPAYh8Dp3DwXlj96S/RQzYWcTqBdQQdO9lJ+EvF+/oA1QoAWfEu3wXx3DwVa VIEeu3divkc5rHoYJI8Wh9T8WVteCgFkdo3h82CmL1yYkjs8LC/CtcD1l6SaFhzxCjfV 8EG05UN0/DfIZNfXI3jUjFaakepT7f67z+8ZqumMNQRO/YZv3hxZbdqFe9dT1+MpbiXn 0y/JUQVLOHW9hcngBIykHwC0MiZiq2Tiy9jJO9k3Zn5dVToXs/W96l1Fh8W/RMoajv4Q GZdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a143-v6si19021965pfd.241.2018.09.17.19.56.26; Mon, 17 Sep 2018 19:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728873AbeIRI0o (ORCPT + 99 others); Tue, 18 Sep 2018 04:26:44 -0400 Received: from mga01.intel.com ([192.55.52.88]:17874 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbeIRI0o (ORCPT ); Tue, 18 Sep 2018 04:26:44 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2018 19:56:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,388,1531810800"; d="scan'208";a="71644801" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.126]) by fmsmga008.fm.intel.com with ESMTP; 17 Sep 2018 19:56:16 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id EF1F0300F9A; Mon, 17 Sep 2018 19:56:16 -0700 (PDT) Date: Mon, 17 Sep 2018 19:56:16 -0700 From: Andi Kleen To: "Gonglei (Arei)" Cc: Wei Wang , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "kan.liang@intel.com" , "peterz@infradead.org" , "mingo@redhat.com" , "rkrcmar@redhat.com" , "like.xu@intel.com" Subject: Re: [PATCH v2 7/8] KVM: PMU: support to save/restore the guest lbr stack on vCPU switching Message-ID: <20180918025616.GA10360@tassilo.jf.intel.com> References: <1536233456-12173-1-git-send-email-wei.w.wang@intel.com> <1536233456-12173-8-git-send-email-wei.w.wang@intel.com> <33183CC9F5247A488A2544077AF19020DB0F1D5F@dggeml511-mbx.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33183CC9F5247A488A2544077AF19020DB0F1D5F@dggeml511-mbx.china.huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > From: Like Xu > > > > This patch adds support to KVM to save/restore the lbr stack on vCPU > > context switching. > > > > When the guest sets the ACTIVE bit of MSR_KVM_PV_LBR_CTRL, a perf event > > is created on the host for the related vCPU. This perf event ensures the > > LBR stack to be saved/restored when the vCPU thread is scheduled out/in. > > The perf event is removed and freed when the guest clears the ACTIVE > > bit. > > > > What about live migration? Does LBR stack need to be saved on the source side and > restored on the dest side with the passthrough mode? Yes it should. Either for call stack LBR, or when it is frozen/disabled. When it's not frozen/disabled and not in call stack LBR mode it likely doesn't hurt either, but it's not strictly needed because it will be replaced so quickly. -Andi