From nobody Mon May 6 19:59:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1558518439; cv=none; d=zoho.com; s=zohoarc; b=g6V6wCSAjE8uqfvvT6Tq4YqrCEMYmPK4aYFwBZjOjIHtD7Mdmx++S1FBI8pB42XwVSk4iaMImpKg8A5D/L73lpJ81Uff7E7fzaONvDeyUt0TKjiyJOumgadsksou5/d6+9wm+kxTz8lCk8B8+zieV0JJno+X0DXnLkEpvlRAfoE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558518439; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0FieSynGniYoLnmsyGwQ22Wi/aM5mRnu9u2YVUxIN9o=; b=PA5SsdIpOEKVV1sT4aou173bcLmn98hxd/kwAtLp3gbva5RZnqr3yyCss+UBcqyXzuC+qBxaxzNvD7yBdR9Yl6jKnyxKnSdc5fZUV+i2YCvMf4PSK5gPSpVfXVnp5SW9L+SxQ4RSJu/sgXqv/0rw/0xB4AXkQIXMAiRMqH6cCvw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.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 1558518439749977.6727387432411; Wed, 22 May 2019 02:47:19 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTNou-0006WW-Rt; Wed, 22 May 2019 09:46:00 +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 1hTNot-0006Vo-Vl for xen-devel@lists.xenproject.org; Wed, 22 May 2019 09:46:00 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 63e2fc0c-7c76-11e9-9cbe-4347524bb1c0; Wed, 22 May 2019 09:45:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2ABA5AF11; Wed, 22 May 2019 09:45:53 +0000 (UTC) X-Inumbo-ID: 63e2fc0c-7c76-11e9-9cbe-4347524bb1c0 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 22 May 2019 11:45:47 +0200 Message-Id: <20190522094549.28397-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190522094549.28397-1-jgross@suse.com> References: <20190522094549.28397-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 1/3] xen: drop in_atomic() 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 , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= 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" Currently there is only one user of in_atomic(), and that is in an #ifdef 0 section. This has been so since Xen 4.1, so chances are rather slim we suddenly want to enable it again. Dropping in_atomic() will remove the last user of preempt_count() in non-debug builds enabling further optimizations. Signed-off-by: Juergen Gross Reviewed-by: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 16 ---------------- xen/common/preempt.c | 5 ----- xen/include/xen/preempt.h | 2 -- 3 files changed, 23 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8993c2aa57..7b36765b97 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3185,22 +3185,6 @@ static enum hvm_translation_result __hvm_copy( =20 ASSERT(is_hvm_vcpu(v)); =20 - /* - * XXX Disable for 4.1.0: PV-on-HVM drivers will do grant-table ops - * such as query_size. Grant-table code currently does copy_to/from_gu= est - * accesses under the big per-domain lock, which this test would disal= low. - * The test is not needed until we implement sleeping-on-waitqueue when - * we access a paged-out frame, and that's post 4.1.0 now. - */ -#if 0 - /* - * If the required guest memory is paged out, this function may sleep. - * Hence we bail immediately if called from atomic context. - */ - if ( in_atomic() ) - return HVMTRANS_unhandleable; -#endif - while ( todo > 0 ) { enum hvm_translation_result res; diff --git a/xen/common/preempt.c b/xen/common/preempt.c index 3b4178fd44..20913e20d3 100644 --- a/xen/common/preempt.c +++ b/xen/common/preempt.c @@ -25,11 +25,6 @@ =20 DEFINE_PER_CPU(unsigned int, __preempt_count); =20 -bool_t in_atomic(void) -{ - return preempt_count() || in_irq() || !local_irq_is_enabled(); -} - #ifndef NDEBUG void ASSERT_NOT_IN_ATOMIC(void) { diff --git a/xen/include/xen/preempt.h b/xen/include/xen/preempt.h index bef83135a1..f715ca09bc 100644 --- a/xen/include/xen/preempt.h +++ b/xen/include/xen/preempt.h @@ -26,8 +26,6 @@ DECLARE_PER_CPU(unsigned int, __preempt_count); preempt_count()--; \ } while (0) =20 -bool_t in_atomic(void); - #ifndef NDEBUG void ASSERT_NOT_IN_ATOMIC(void); #else --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 19:59:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1558518438; cv=none; d=zoho.com; s=zohoarc; b=FjhNTI/WqravQ1KEDb4yZcXWPLdAjHFzpo+LLkR0PaK1HvsL4OyKkwB4NwCgK5ND02wT3S4bUzHCmFB6KjkS5W1qdOHmSFOezn2uFP9X3J1u52ez/xiZzBDbqWhf2OzFY0h3EVVpaA3BmsD7VUWP2a+6G85x6A0sV5XdbD/JIxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558518438; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=YTbOdQ1nj7fikPplVBbCwikXczIcSDJFsoIPKBHb9sU=; b=mAgMEvUBC7f7Tem0k+MSH2E+XTdyiR+2o6ZHrQX2C19tXbF2yWKDp51uXvX7P9FPxpQQ1xGCuhHijWtPrTb6y32CwDHj6qcXD6qVqCHoTFL4OTKp8R8tv5zjY9sn+JbQ9xy11iq/GTimYOROXSWKYWc1P7cHYo14Ec0nNBT+a9E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.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 1558518437896382.23281839997276; Wed, 22 May 2019 02:47:17 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTNos-0006Vi-I4; Wed, 22 May 2019 09:45:58 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTNoq-0006VJ-A3 for xen-devel@lists.xenproject.org; Wed, 22 May 2019 09:45:56 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 6402ac35-7c76-11e9-8980-bc764e045a96; Wed, 22 May 2019 09:45:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 714D6AF21; Wed, 22 May 2019 09:45:53 +0000 (UTC) X-Inumbo-ID: 6402ac35-7c76-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 22 May 2019 11:45:48 +0200 Message-Id: <20190522094549.28397-3-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190522094549.28397-1-jgross@suse.com> References: <20190522094549.28397-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 2/3] xen: drop preempt_count() for non-debug builds 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" preempt_count() and the associated per-cpu variable __preempt_count are tested in debug build only. So drop them for non-debug builds. Signed-off-by: Juergen Gross Reviewed-by: Andrew Cooper , ideally with the --- xen/common/preempt.c | 2 +- xen/include/xen/preempt.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/common/preempt.c b/xen/common/preempt.c index 20913e20d3..3077c51d52 100644 --- a/xen/common/preempt.c +++ b/xen/common/preempt.c @@ -23,9 +23,9 @@ #include #include =20 +#ifndef NDEBUG DEFINE_PER_CPU(unsigned int, __preempt_count); =20 -#ifndef NDEBUG void ASSERT_NOT_IN_ATOMIC(void) { ASSERT(!preempt_count()); diff --git a/xen/include/xen/preempt.h b/xen/include/xen/preempt.h index f715ca09bc..0bf49cc979 100644 --- a/xen/include/xen/preempt.h +++ b/xen/include/xen/preempt.h @@ -12,6 +12,8 @@ #include #include =20 +#ifndef NDEBUG + DECLARE_PER_CPU(unsigned int, __preempt_count); =20 #define preempt_count() (this_cpu(__preempt_count)) @@ -26,9 +28,11 @@ DECLARE_PER_CPU(unsigned int, __preempt_count); preempt_count()--; \ } while (0) =20 -#ifndef NDEBUG void ASSERT_NOT_IN_ATOMIC(void); + #else +#define preempt_disable() barrier(); +#define preempt_enable() barrier(); #define ASSERT_NOT_IN_ATOMIC() ((void)0) #endif =20 --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 6 19:59:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1558518443; cv=none; d=zoho.com; s=zohoarc; b=B4Ccpc8RkRKzO/uYbub2HGPPBSrDNiWoBBVDRVpI7zWxwYI7S+9tr5eMe/Q4tpuRPnRX+l5lAO18KR32//Wwce16EMex/Pa3bm1OzmFmvJWcbOfhQBaobWomyYgJkKAhfyGt8BaEzEwfzJ5WbfcezAzZznIHVrsA93SxAobNBrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558518443; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=kcK8GzJOpbcoUJMQKYa654ZqiLT+5LVqaVX1yWWnbDs=; b=TGZXrBxlYMtjMispqgDgboYBTLNQGI7HmpH8KDIDH7DT6adOxbS8N8zbN9ODW9U1tDZkt9Rt0Rm7Vrl9GabRtwyrl4DaNv1ocIMBbYiuiMOizTKrAHBQz2cHP5hvHn7nKcDdmy03Xtw5MR91mTXLecVsWvluwtScFTyV5tua7h0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.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 1558518443387138.68435620453397; Wed, 22 May 2019 02:47:23 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTNos-0006Vc-8b; Wed, 22 May 2019 09:45:58 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTNoq-0006VI-A0 for xen-devel@lists.xenproject.org; Wed, 22 May 2019 09:45:56 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 642b236b-7c76-11e9-8980-bc764e045a96; Wed, 22 May 2019 09:45:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id B27E9AF25; Wed, 22 May 2019 09:45:53 +0000 (UTC) X-Inumbo-ID: 642b236b-7c76-11e9-8980-bc764e045a96 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 22 May 2019 11:45:49 +0200 Message-Id: <20190522094549.28397-4-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190522094549.28397-1-jgross@suse.com> References: <20190522094549.28397-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 3/3] xen: build common/preempt.c only with 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 , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , 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" There is nothing left in common/preempt.c in non-debug builds. Signed-off-by: Juergen Gross --- xen/common/Makefile | 2 +- xen/common/preempt.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/xen/common/Makefile b/xen/common/Makefile index 33d03b862f..d6576a3fc3 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -30,7 +30,7 @@ obj-y +=3D notifier.o obj-y +=3D page_alloc.o obj-$(CONFIG_HAS_PDX) +=3D pdx.o obj-$(CONFIG_PERF_COUNTERS) +=3D perfc.o -obj-y +=3D preempt.o +obj-$(CONFIG_DEBUG) +=3D preempt.o obj-y +=3D random.o obj-y +=3D rangeset.o obj-y +=3D radix-tree.o diff --git a/xen/common/preempt.c b/xen/common/preempt.c index 3077c51d52..8bb099e8e8 100644 --- a/xen/common/preempt.c +++ b/xen/common/preempt.c @@ -23,7 +23,6 @@ #include #include =20 -#ifndef NDEBUG DEFINE_PER_CPU(unsigned int, __preempt_count); =20 void ASSERT_NOT_IN_ATOMIC(void) @@ -32,4 +31,3 @@ void ASSERT_NOT_IN_ATOMIC(void) ASSERT(!in_irq()); ASSERT(local_irq_is_enabled()); } -#endif --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel