Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1295615rwn; Thu, 8 Sep 2022 17:13:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/vJMEmRrDdOpExZ9aWnEZXXquZrCRAbSd0Ox5sdaJb6ta/FiifwfwlqqWCY52+8O3OWZX X-Received: by 2002:a2e:9653:0:b0:26a:c786:a104 with SMTP id z19-20020a2e9653000000b0026ac786a104mr2990729ljh.183.1662682405642; Thu, 08 Sep 2022 17:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662682405; cv=none; d=google.com; s=arc-20160816; b=dayOwKgtMeBF/1GZepqf4xJlUWta5CA1N/9KEyWWwIfiOKOihgnGD1sCnvLdr+nyfX wsiLkpTFlF9WHMwGt7SNwXBwKcgTFRbHSD1Jj39zhGzJ0cF0ksIdAGYlvV/ofzfK/UW6 3tg5ZcCkPgDJIojIhcNQI6P4nNGHtxlSsS8RGNaVZlZWhMFWoXTulZkBr34rta/5g3mk Kp0e/9d4FdSkSxyRNMKHCrFSEjM3SDJU13JAbDtENWnS8GeS0H+i/vAjw1lcm3s/++6u HQTIxa69if2Lv+wNM5UiA7hq2SYkIVMGQcTaN/Xouv5rKB85SMMKrsK1PVFlBCmkYCpk cfLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fIwSk+e8zv7wRgPSXt3Ao7dbzzHIa/fEth6FLmhNMkA=; b=XxjxQemKmVZxOY+TX2ZVDeP1yaZ/3HBHxOUWLCP3XfRGTElsXlIq8LOyAchi3ZlIaC 5H56qJ8QEbxSmb6/6rUL3fq3ImymIrYFHxsraSDRm8tAIaEmzEmGxxOfCBhUi74q//AN /1qziGoynpWEWeIW/5vOlteU+tqFtST+w1+6ejQMdGshTIdGXeZDRxv8cT2Mmeivbffx opFNJfnL0NgFe1F+d+1O4tDbooKnlTwdk158Kq4SORYc3Us9SlJI8yyzwGHpIZ3/1Ei3 1gknrBVDqpelf0Rs6cdKifsje50qZeFe7Jm8eiBcFQ3l3DoMA2eYflpIawihg3keOX6f CPpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jt4+vvg8; 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 m7-20020a2ea587000000b0026bddea5233si171444ljp.40.2022.09.08.17.12.56; Thu, 08 Sep 2022 17:13:25 -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=jt4+vvg8; 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 S229892AbiIHX0Y (ORCPT + 99 others); Thu, 8 Sep 2022 19:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbiIHX0I (ORCPT ); Thu, 8 Sep 2022 19:26:08 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE5EE6BA1; Thu, 8 Sep 2022 16:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662679567; x=1694215567; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xg0WmMFTfA/g4jLjPGWiDRFU62B4P5RAx9DcjKdahlo=; b=jt4+vvg8LDXTn8uaQYUggCjemcXodlms/P9fsBReVjICUauvcgnJfOjX RkZnu+6W9sNZwP1TC5Ez5zQNFrMZA1tI5+GNFspUe11+l9rRWr/61fggW uNAO1hG3WmMKO0qr0ARrf5Z3KRtRxxXIs6rPVIWjvbSeMZNVgDsM1zhWW wHX44Cdy/MWxX0hlHvT+WcGGTK77F9ZzKfCXMhnLEqdD8tHPjLhz7/M/H gdOnLONYLxdixDAcf40I5gbFl+YkMPik7K25uMROjyEII/Pbxxl6RXHLd e9o+xrDrOmXkDBqsuelBaccZzUSo3tnHrOfLGBWT+BzJbxtcSLX+kwKj9 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="298686983" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="298686983" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:05 -0700 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="610863164" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 16:26:05 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Will Deacon , Yuan Yao Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen , Yuan Yao Subject: [PATCH v4 05/26] KVM: Provide more information in kernel log if hardware enabling fails Date: Thu, 8 Sep 2022 16:25:21 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 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