From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B22E6ECAAD5 for ; Mon, 5 Sep 2022 09:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237264AbiIEJ1U (ORCPT ); Mon, 5 Sep 2022 05:27:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235459AbiIEJ1R (ORCPT ); Mon, 5 Sep 2022 05:27:17 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E33E2F674; Mon, 5 Sep 2022 02:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662370037; x=1693906037; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=o5on7g5eU/u1Xj26JnLalnuCczll+Sh3zwqNAD3wro8=; b=mSUZlriTCYUjZy7UhAVR+7NphSV6LO+Gx7N2tmHCvxMkHMDavyDIVFLb 4BhR2S68Z0YrO6WM2Qx1Azhr7ERYtKaWhT2Xmer+kRQtjSz/O2uP0kXs3 C4Sgzkv1cxYXcNq8cFxHFwqaGp5zL1/EiVSsW8xczr49zfIKV7IomYD76 GZP7vUFXlO8wa3wJK/C5jbgNtBOw5kHuQ/NnciDRysbqx+8VHYRwlle16 QgMyZ0gUbZt/nqsPhwbwmQAni9f45yrVy0+M/3Znb9X6MHSrt5XTJcWMV PNjjvZaL+y9ulCRLPfFPftVYODqGof+3H9WXRYl3muy4Pi0ZZPoxD/N22 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10460"; a="276743134" X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="276743134" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 02:27:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="675213318" Received: from yy-desk-7060.sh.intel.com (HELO localhost) ([10.239.159.76]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2022 02:27:13 -0700 Date: Mon, 5 Sep 2022 17:27:12 +0800 From: Yuan Yao To: isaku.yamahata@intel.com Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon , isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: Re: [PATCH v3 09/22] KVM: Do processor compatibility check on resume Message-ID: <20220905092712.5mque5oajiaj7kuq@yy-desk-7060> References: <20220905084014.uanoazei77i3xjjo@yy-desk-7060> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220905084014.uanoazei77i3xjjo@yy-desk-7060> User-Agent: NeoMutt/20171215 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 05, 2022 at 04:40:14PM +0800, Yuan Yao wrote: > On Thu, Sep 01, 2022 at 07:17:44PM -0700, isaku.yamahata@intel.com wrote: > > From: Isaku Yamahata > > > > So far the processor compatibility check is not done on resume. It should > > be done. > > The resume happens for resuming from S3/S4, so the compatibility > checking is used to detecte CPU replacement, or resume from S4 on an > different machine ? By did experiments, I found the resume is called once on CPU 0 before other CPUs come UP, so yes it's necessary to check it. > > > > > Signed-off-by: Isaku Yamahata > > --- > > virt/kvm/kvm_main.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > > index 0ac00c711384..fc55447c4dba 100644 > > --- a/virt/kvm/kvm_main.c > > +++ b/virt/kvm/kvm_main.c > > @@ -5715,6 +5715,13 @@ static int kvm_suspend(void) > > > > static void kvm_resume(void) > > { > > + if (kvm_arch_check_processor_compat()) > > + /* > > + * No warning here because kvm_arch_check_processor_compat() > > + * would have warned with more information. > > + */ > > + return; /* FIXME: disable KVM */ > > + > > if (kvm_usage_count) { > > lockdep_assert_not_held(&kvm_count_lock); > > hardware_enable_nolock((void *)__func__); > > -- > > 2.25.1 > >