From patchwork Thu May 9 10:47:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 10936981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F81313AD for ; Thu, 9 May 2019 10:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E8DD28726 for ; Thu, 9 May 2019 10:47:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2146328735; Thu, 9 May 2019 10:47:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B01828726 for ; Thu, 9 May 2019 10:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbfEIKrI (ORCPT ); Thu, 9 May 2019 06:47:08 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:44464 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbfEIKrH (ORCPT ); Thu, 9 May 2019 06:47:07 -0400 Received: from mse-fl1.zte.com.cn (unknown [10.30.14.238]) by Forcepoint Email with ESMTPS id 12BAC9BBD87513C55F72; Thu, 9 May 2019 18:47:03 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse-fl1.zte.com.cn with ESMTP id x49AktYE044383; Thu, 9 May 2019 18:46:55 +0800 (GMT-8) (envelope-from wang.yi59@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019050918471900-10203318 ; Thu, 9 May 2019 18:47:19 +0800 From: Yi Wang To: pbonzini@redhat.com Cc: rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org, sean.j.christopherson@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn Subject: [PATCH v2] [next] KVM: lapic: allow set apic debug dynamically Date: Thu, 9 May 2019 18:47:57 +0800 Message-Id: <1557398877-32750-1-git-send-email-wang.yi59@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-05-09 18:47:19, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-05-09 18:46:41, Serialize complete at 2019-05-09 18:46:41 X-MAIL: mse-fl1.zte.com.cn x49AktYE044383 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are many functions invoke apic_debug(), which is defined a null function by default, and that's incovenient for debuging lapic. This patch allows setting apic debug according to add a apic_dbg parameter of kvm. Signed-off-by: Yi Wang --- v2: change apic_dbg to bool and tag __read_mostly. Thanks to Sean. arch/x86/kvm/lapic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 9bf70cf..0827e7c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -54,8 +54,13 @@ #define PRIu64 "u" #define PRIo64 "o" +static bool apic_dbg __read_mostly; +module_param(apic_dbg, bool, 0644); + /* #define apic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */ -#define apic_debug(fmt, arg...) do {} while (0) +#define apic_debug(fmt, arg...) do { if (apic_dbg) \ + printk(KERN_DEBUG fmt, ##arg); \ +} while (0) /* 14 is the version for Xeon and Pentium 8.4.8*/ #define APIC_VERSION (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 16))