From nobody Thu Apr 25 22:51:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1578548475; cv=none; d=zohomail.com; s=zohoarc; b=Zcti09QpQFE26S3j2r8PcSAKXPuz5mSfqbfdRkD95Ihyn7D2a3r8ulFbbctsZQPEON20pzcHEITXCpMSEQo/RGM/w12bRJHtquBSnkhYvkAJN4LKVAhXLEAfB1aEBOV9h3RqqhnV4QCSOGmJtbbP61oYLtalFdH84M0F7HY06YQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578548475; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=p4x49jUMrhlclnwYZavtHuSrbh9VpCGC2XlKEeENY4Q=; b=Ij4Ddq6UIpB2u75XDA9rv/l3aE3RxmHZOWiiaEyUCmP/9SZX0gIaGtxQiEc2IkvejO3ootcvvADuJDbDfTuMM4pKDJDLjulQ2BmHFAmZSJF3xJSj7iuaE7QMF7HKOAUJ/aqgaLJkWO0nWnKNinBKVEwHTqFn+S5wYnDEfltNSGY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578548475164374.04132044716584; Wed, 8 Jan 2020 21:41:15 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipQYm-0000Tr-VG; Thu, 09 Jan 2020 05:40:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipQYl-0000Tk-Td for xen-devel@lists.xenproject.org; Thu, 09 Jan 2020 05:40:43 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8e6adab6-32a2-11ea-b1f0-bc764e2007e4; Thu, 09 Jan 2020 05:40:35 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D59C1ABE9; Thu, 9 Jan 2020 05:40:33 +0000 (UTC) X-Inumbo-ID: 8e6adab6-32a2-11ea-b1f0-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Thu, 9 Jan 2020 06:40:31 +0100 Message-Id: <20200109054031.18455-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen: make CONFIG_DEBUG_LOCKS usable without CONFIG_DEBUG 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 , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In expert mode it is possible to enable CONFIG_DEBUG_LOCKS without having enabled CONFIG_DEBUG. The coding is depending on CONFIG_DEBUG as it is using ASSERT(), however. Fix that by introducing assert() doing the same as ASSERT(), but being available in non-debug builds, too, and use that in spinlock debug code. Signed-off-by: Juergen Gross --- xen/common/spinlock.c | 2 +- xen/include/xen/lib.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c index 286f916bca..8f54580d24 100644 --- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -86,7 +86,7 @@ static void got_lock(union lock_debug *debug) static void rel_lock(union lock_debug *debug) { if ( atomic_read(&spin_debug) > 0 ) - ASSERT(debug->cpu =3D=3D smp_processor_id()); + assert(debug->cpu =3D=3D smp_processor_id()); debug->cpu =3D SPINLOCK_NO_CPU; } =20 diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 8fbe84032d..000ea677d0 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -32,9 +32,11 @@ #define gcov_string "" #endif =20 -#ifndef NDEBUG -#define ASSERT(p) \ +#define assert(p) \ do { if ( unlikely(!(p)) ) assert_failed(#p); } while (0) + +#ifndef NDEBUG +#define ASSERT(p) assert(p) #define ASSERT_UNREACHABLE() assert_failed("unreachable") #define debug_build() 1 #else --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel