Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2709403rwb; Sun, 4 Sep 2022 23:22:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR6u/8xfuJ7AETUYUUhnRgZ/XpjbhioL5KHBvvMynzL9cog1f7Jisiuno/B6EsJt6BXEtEPu X-Received: by 2002:a17:907:2cd4:b0:73c:9fa8:3ddc with SMTP id hg20-20020a1709072cd400b0073c9fa83ddcmr25584819ejc.40.1662358926913; Sun, 04 Sep 2022 23:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662358926; cv=none; d=google.com; s=arc-20160816; b=ju5dBaaErQgk9ARyCv7eST2Emz89Vad64pY8uV9SbzpI7epe4QwlUEp/UigJwRVeCL +yhSLSxrCocp/fuN3JQqhurXhIduALPaiDurHoUYbfHR4RfW5V7Bhzq0S1F9O20yAeC1 owQ5wkzsO8MbAEdjV8ocCGbCRZFTy3Ib+BUwAuAcBCs6DYMGPcWCuLxgSBs25XkoN7id 5TpOBkW4u4hM59wEEbcJa2KyXzcCmxdWeNMmd7WPTZrxsWByIbApOQcWyhXBeRBvdgfx nypm741ahp3NC+xSPMCZQ8m3Vzeh8yAXHDyM7Ty7d2LEivQbe0FJhGMurloiEtkK51al Gt7A== 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=nerQqdidA/f9ryIKYpyeTKI82mXz9o6vgnTCHCdcQpU=; b=mBwwdba/MkURy+NA0X6bI3AESP5t/ZDjyWuGXqjOy9O1MafcCOvaL6dwvL6fzfTj7O p/zJ6YfN/Dj/j8wQIVmTzJMfaCOwkAukFllHQzpwSyKKqaYQBCx/MbAkR87IzYW+WL9s 8sXpbP5rVKgROM+KMnbsVzWEeQziR1AUeOFWxnqnXc9cjoBuv993fVA2+0meYQBU8+Vz qvhIfnN1W5xtrbPhHMBBPk9ZnKnCPBk23LCvS/xqM44TVbDVqxj68+1C6xjRxdkSucxU 74JBBLptaF3MwzB+C594AhdJUfUNnvFpzUJT1YNIyLuMSqEAdyFwJfheXfxRrcpSrLGb GujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=W6pL3atr; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne27-20020a1709077b9b00b0073d19e6ce0bsi7730575ejc.301.2022.09.04.23.21.41; Sun, 04 Sep 2022 23:22:06 -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=@intel.com header.s=Intel header.b=W6pL3atr; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236429AbiIEF5L (ORCPT + 99 others); Mon, 5 Sep 2022 01:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235572AbiIEF42 (ORCPT ); Mon, 5 Sep 2022 01:56:28 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21E3124F13; Sun, 4 Sep 2022 22:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662357384; x=1693893384; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=x8BHU7dXBHq49U9pCxfDkV5wzV1bnWJ0MiFkkKRvgo4=; b=W6pL3atrNEU4yI7DGrNLmaOCKkPQilTdJv3sZunSUAtPu/pzAEMYsViG Hg/AzmBknMdTi6tY1zaUkhQSNlwe4nV1lgFv2I9s79270wcTz94dcgjAt Fys3atMXHJbOA+dp9eRWsxuqeXvb6F9L4XakuGVv/mwSF3aCxaN6c6ge3 vMKGhHx4uPfa6yS+jMYljLcqTKOEPMy3w+lfssk6yoK7mGEgoOy9jynhh lIcYJb3Y5l6y7Iy8/DfmiSdl1WRthzREPP8QKlhhc+LCyhDNw3LHSfx9E LMugORz0JZa9Rlq+rAYn8LO8knzYi2R6yQY1hhJbhu7mBJJokrV7MkICf w==; X-IronPort-AV: E=McAfee;i="6500,9779,10460"; a="279328604" X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="279328604" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Sep 2022 22:56:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,290,1654585200"; d="scan'208";a="609571229" Received: from yy-desk-7060.sh.intel.com (HELO localhost) ([10.239.159.76]) by orsmga007.jf.intel.com with ESMTP; 04 Sep 2022 22:56:18 -0700 Date: Mon, 5 Sep 2022 13:56:17 +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 05/22] KVM: Provide more information in kernel log if hardware enabling fails Message-ID: <20220905055617.cup6tloqxurqznmo@yy-desk-7060> References: <5f659936255837f77e821011bb9445a98322e3ae.1662084396.git.isaku.yamahata@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f659936255837f77e821011bb9445a98322e3ae.1662084396.git.isaku.yamahata@intel.com> User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, 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 Thu, Sep 01, 2022 at 07:17:40PM -0700, isaku.yamahata@intel.com wrote: > From: Sean Christopherson > > Provide the name of the calling function to hardware_enable_nolock() and > include it in the error message to provide additional information on > exactly what path failed. > > Opportunistically bump the pr_info() to pr_warn(), failure to enable > virtualization support is warn-worthy as _something_ is wrong with the > system. > > Signed-off-by: Sean Christopherson > Signed-off-by: Chao Gao > Link: https://lore.kernel.org/r/20220216031528.92558-4-chao.gao@intel.com > Signed-off-by: Isaku Yamahata Reviewed-by: Yuan Yao > --- > virt/kvm/kvm_main.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 4243a9541543..278eb6cc7cbe 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -4991,7 +4991,7 @@ static struct miscdevice kvm_dev = { > &kvm_chardev_ops, > }; > > -static void hardware_enable_nolock(void *junk) > +static void hardware_enable_nolock(void *caller_name) > { > int cpu = raw_smp_processor_id(); > int r; > @@ -5006,7 +5006,8 @@ static void hardware_enable_nolock(void *junk) > if (r) { > cpumask_clear_cpu(cpu, cpus_hardware_enabled); > atomic_inc(&hardware_enable_failed); > - pr_info("kvm: enabling virtualization on CPU%d failed\n", cpu); > + pr_warn("kvm: enabling virtualization on CPU%d failed during %s()\n", > + cpu, (const char *)caller_name); > } > } > > @@ -5014,7 +5015,7 @@ static int kvm_starting_cpu(unsigned int cpu) > { > raw_spin_lock(&kvm_count_lock); > if (kvm_usage_count) > - hardware_enable_nolock(NULL); > + hardware_enable_nolock((void *)__func__); > raw_spin_unlock(&kvm_count_lock); > return 0; > } > @@ -5063,7 +5064,7 @@ static int hardware_enable_all(void) > kvm_usage_count++; > if (kvm_usage_count == 1) { > atomic_set(&hardware_enable_failed, 0); > - on_each_cpu(hardware_enable_nolock, NULL, 1); > + on_each_cpu(hardware_enable_nolock, (void *)__func__, 1); > > if (atomic_read(&hardware_enable_failed)) { > hardware_disable_all_nolock(); > @@ -5686,7 +5687,7 @@ static void kvm_resume(void) > { > if (kvm_usage_count) { > lockdep_assert_not_held(&kvm_count_lock); > - hardware_enable_nolock(NULL); > + hardware_enable_nolock((void *)__func__); > } > } > > -- > 2.25.1 >