From patchwork Wed Aug 7 14:31:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11082281 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 BE439912 for ; Wed, 7 Aug 2019 14:32:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACC5928A92 for ; Wed, 7 Aug 2019 14:32:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0D7A285CE; Wed, 7 Aug 2019 14:32:43 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FCE028A75 for ; Wed, 7 Aug 2019 14:32:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvMyM-0000yT-4n; Wed, 07 Aug 2019 14:31:26 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvMyK-0000y5-Tj for xen-devel@lists.xenproject.org; Wed, 07 Aug 2019 14:31:24 +0000 X-Inumbo-ID: 078bee50-b920-11e9-b7f8-5ba9b72e5674 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 078bee50-b920-11e9-b7f8-5ba9b72e5674; Wed, 07 Aug 2019 14:31:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 84D6EB034; Wed, 7 Aug 2019 14:31:22 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 7 Aug 2019 16:31:17 +0200 Message-Id: <20190807143119.8360-3-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190807143119.8360-1-jgross@suse.com> References: <20190807143119.8360-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 2/4] xen: add new CONFIG_SPINLOCK_DEBUG option X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of enabling spinlock debugging for debug builds only add a dedicated Kconfig option for that purpose which defaults to DEBUG. Signed-off-by: Juergen Gross --- xen/Kconfig.debug | 7 +++++++ xen/common/spinlock.c | 4 ++-- xen/include/xen/spinlock.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index e10e314e25..5db3e7ec25 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -44,6 +44,13 @@ config COVERAGE If unsure, say N here. +config SPINLOCK_DEBUG + bool "Spinlock debugging" + default DEBUG + ---help--- + Enable debugging features of spinlock handling. Some additional + checks will be performed when acquiring and releasing locks. + config LOCK_PROFILE bool "Lock Profiling" ---help--- diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 4e681cc651..16356ec9b7 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -9,7 +9,7 @@ #include #include -#ifndef NDEBUG +#ifdef CONFIG_SPINLOCK_DEBUG static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0); @@ -97,7 +97,7 @@ void spin_debug_disable(void) atomic_dec(&spin_debug); } -#else /* defined(NDEBUG) */ +#else /* CONFIG_SPINLOCK_DEBUG */ #define check_lock(l) ((void)0) #define check_barrier(l) ((void)0) diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index b4881ad433..e3458f10dd 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -6,7 +6,7 @@ #include #include -#ifndef NDEBUG +#ifdef CONFIG_SPINLOCK_DEBUG union lock_debug { unsigned short val; struct {