Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1796303pxb; Wed, 9 Feb 2022 04:50:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzm9BIU/xWQAd/OefNFTbUMxzDvqyauFaURkkQp27hZFZuMtE6wHli1/n5MsdSvAQDUO9Mc X-Received: by 2002:a63:2307:: with SMTP id j7mr1777751pgj.400.1644411012243; Wed, 09 Feb 2022 04:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644411012; cv=none; d=google.com; s=arc-20160816; b=b5bEZZnvMhaPfS0CUkvL8GnEtAsk2ciotOgggKc8wttHoA5IvPiGHertub/zFf84nj dOKPkvTuemNeIxp7/sfUkOFoNjqnLjYp2TZUWLaiQ60eCjBP3JqwpnLi0WjyB30wWjiQ /LSa0GnXlIfs2pmVTG13Rn6IL9xcNuwlnqVWotd3rqbGr+O8X8gjzCBZHbGYLiHnbT0u Zx13C5BLsLABVxLkmXlQT6IS6R+QTcmUXjWLhPlxcZCKoU9H6n84Jd+nTuSMjMxeSeZK GrQ1TLaKuwHU1aKGYV387Y6z9ayu/VSOQnAYuxwvELzziLsRLUbwZdSGsD1Zc2+RzZch rutw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KioekNcYTEc77cfP9/K/E3ycIO+Oz8+m196o5Zz7osY=; b=ZR0yuXcXWIW6n8C749Ryjhu55gbTzuIBVC0nGrgw1W7AvwswWp1xWUWnsXkyaSwjMV h6ddlLwdzOPt/ijWL9/YThnHdA18uOkVkqYKts0T6COQX8NW12jGxT/yrmUuNTk5/TWc A/sLMuS8cGj+f/2KGldbWZOHuAhNy3U/I34E5pb5m6hTNx9GC1Yl44JituDzgyniXBJf ZksCfbrlfhFAPrNHVv5SXdbvv2xsoJIY8dPikX5YHmVFkWdbjlB7m3E9QbaiDFxHojr7 h+7JvwDYaYte62QxY/bPB3zXOYciuyGxniXFAb5XNRFwot5wPKJo+bf75QJMdG7TjCz6 aHdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JAKJTt7l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d2si17300280plh.495.2022.02.09.04.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:50:12 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JAKJTt7l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 06EE9E15ACDA; Wed, 9 Feb 2022 02:30:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239123AbiBIHs6 (ORCPT + 99 others); Wed, 9 Feb 2022 02:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237374AbiBIHsz (ORCPT ); Wed, 9 Feb 2022 02:48:55 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E30C0613CB; Tue, 8 Feb 2022 23:48:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644392939; x=1675928939; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=UHxQ0y6ReTg5fAil+JKwO37ROUMI1ZBKsYOkDDrvDa0=; b=JAKJTt7lQ3ErEl1627tkNZltivTKJCYgoSsISDIzydbmgqDXe5PULrxB EIfJx62CVNN6HebphBDc/DnD+HsJW+d3nPGZvogpDXBV8gHgPFl9Ii5oC V9atX26WowaahJXqHSYPu5Bl65ZAOx+vOKQKHd1I6rQkUyL4UDlZJQCH+ 5AMwdrkE0Pw18bdf5ceUMNHldCzx4c9Bqo+gSo+8HqagjS7R0K0i0QKl6 Aih6qw0SL+oZrC1yCNFsgdtOFgEad2wDOD4fewyNeGRxOxZ1uNwtEp8KA lEintS/aIaQq0l308ODwwZJQ4PqmwnNbg3BE4JYvp4vsfh/gfGY6I70fL g==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="273682787" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="273682787" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 23:48:59 -0800 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="525893576" Received: from gao-cwp.sh.intel.com (HELO gao-cwp) ([10.239.159.105]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2022 23:48:56 -0800 Date: Wed, 9 Feb 2022 15:59:51 +0800 From: Chao Gao To: Sean Christopherson Cc: kvm@vger.kernel.org, pbonzini@redhat.com, kevin.tian@intel.com, tglx@linutronix.de, John Garry , Will Deacon , "Darrick J. Wong" , Shaokun Zhang , Thomas Richter , Tony Lindgren , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section Message-ID: <20220209075950.GA7943@gao-cwp> References: <20220118064430.3882337-1-chao.gao@intel.com> <20220118064430.3882337-4-chao.gao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Feb 09, 2022 at 12:29:57AM +0000, Sean Christopherson wrote: >On Tue, Jan 18, 2022, Chao Gao wrote: >> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c >> index 148f7169b431..528741601122 100644 >> --- a/virt/kvm/kvm_main.c >> +++ b/virt/kvm/kvm_main.c >> @@ -4856,13 +4856,25 @@ static void hardware_enable_nolock(void *junk) >> } >> } >> >> -static int kvm_starting_cpu(unsigned int cpu) >> +static int kvm_online_cpu(unsigned int cpu) >> { >> + int ret = 0; >> + >> raw_spin_lock(&kvm_count_lock); >> - if (kvm_usage_count) >> + /* >> + * Abort the CPU online process if hardware virtualization cannot >> + * be enabled. Otherwise running VMs would encounter unrecoverable >> + * errors when scheduled to this CPU. >> + */ >> + if (kvm_usage_count) { > > >> hardware_enable_nolock(NULL); >> + if (atomic_read(&hardware_enable_failed)) { > >This needs: > > atomic_set(&hardware_enable_failed, 0); > >otherwise failure to online one CPU will prevent onlining other non-broken CPUs. >It's probably worth adding a WARN_ON_ONCE above this too, e.g. Thanks. All your comments to this series make sense. I just post a revised version.