xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 2/3] xen: drop preempt_count() for non-debug builds
Date: Wed, 22 May 2019 11:45:48 +0200	[thread overview]
Message-ID: <20190522094549.28397-3-jgross@suse.com> (raw)
In-Reply-To: <20190522094549.28397-1-jgross@suse.com>

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 <jgross@suse.com>
---
 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 <xen/irq.h>
 #include <asm/system.h>
 
+#ifndef NDEBUG
 DEFINE_PER_CPU(unsigned int, __preempt_count);
 
-#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 <xen/types.h>
 #include <xen/percpu.h>
 
+#ifndef NDEBUG
+
 DECLARE_PER_CPU(unsigned int, __preempt_count);
 
 #define preempt_count() (this_cpu(__preempt_count))
@@ -26,9 +28,11 @@ DECLARE_PER_CPU(unsigned int, __preempt_count);
     preempt_count()--;                          \
 } while (0)
 
-#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
 
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [Xen-devel] [PATCH 2/3] xen: drop preempt_count() for non-debug builds
Date: Wed, 22 May 2019 11:45:48 +0200	[thread overview]
Message-ID: <20190522094549.28397-3-jgross@suse.com> (raw)
Message-ID: <20190522094548.dB4lUnXg493cO0p99XelRnZKeIEOpoIwB_beG_k3K2w@z> (raw)
In-Reply-To: <20190522094549.28397-1-jgross@suse.com>

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 <jgross@suse.com>
---
 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 <xen/irq.h>
 #include <asm/system.h>
 
+#ifndef NDEBUG
 DEFINE_PER_CPU(unsigned int, __preempt_count);
 
-#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 <xen/types.h>
 #include <xen/percpu.h>
 
+#ifndef NDEBUG
+
 DECLARE_PER_CPU(unsigned int, __preempt_count);
 
 #define preempt_count() (this_cpu(__preempt_count))
@@ -26,9 +28,11 @@ DECLARE_PER_CPU(unsigned int, __preempt_count);
     preempt_count()--;                          \
 } while (0)
 
-#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
 
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-05-22  9:45 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22  9:45 [PATCH 0/3] tune preempt_[dis|en]able() Juergen Gross
2019-05-22  9:45 ` [Xen-devel] " Juergen Gross
2019-05-22  9:45 ` [PATCH 1/3] xen: drop in_atomic() Juergen Gross
2019-05-22  9:45   ` [Xen-devel] " Juergen Gross
2019-05-22  9:58   ` Andrew Cooper
2019-05-22  9:58     ` [Xen-devel] " Andrew Cooper
2019-05-22 10:10   ` Jan Beulich
2019-05-22 10:10     ` [Xen-devel] " Jan Beulich
2019-05-24  5:41     ` Juergen Gross
2019-05-24  5:41       ` [Xen-devel] " Juergen Gross
2019-05-24  6:38       ` Jan Beulich
2019-05-24  6:38         ` [Xen-devel] " Jan Beulich
2019-05-24  8:34         ` Juergen Gross
2019-05-24  8:34           ` [Xen-devel] " Juergen Gross
2019-05-24  8:39           ` Jan Beulich
2019-05-24  8:39             ` [Xen-devel] " Jan Beulich
2019-05-24 12:30             ` Andrew Cooper
2019-05-24 12:30               ` [Xen-devel] " Andrew Cooper
2019-05-24 12:35               ` Jan Beulich
2019-05-24 12:35                 ` [Xen-devel] " Jan Beulich
     [not found]   ` <5CE52014020000780023147E@suse.com>
2019-05-22 10:19     ` Juergen Gross
2019-05-22 10:19       ` [Xen-devel] " Juergen Gross
2019-05-22 12:34       ` Jan Beulich
2019-05-22 12:34         ` [Xen-devel] " Jan Beulich
2019-05-22  9:45 ` Juergen Gross [this message]
2019-05-22  9:45   ` [Xen-devel] [PATCH 2/3] xen: drop preempt_count() for non-debug builds Juergen Gross
2019-05-22 10:00   ` Andrew Cooper
2019-05-22 10:00     ` [Xen-devel] " Andrew Cooper
2019-05-22 10:17     ` Juergen Gross
2019-05-22 10:17       ` [Xen-devel] " Juergen Gross
2019-05-22 10:18     ` Jan Beulich
2019-05-22 10:18       ` [Xen-devel] " Jan Beulich
2019-05-22 10:39       ` Andrew Cooper
2019-05-22 10:39         ` [Xen-devel] " Andrew Cooper
2019-05-22 10:12   ` Jan Beulich
2019-05-22 10:12     ` [Xen-devel] " Jan Beulich
     [not found]   ` <5CE5207A0200007800231481@suse.com>
2019-05-22 10:17     ` Juergen Gross
2019-05-22 10:17       ` [Xen-devel] " Juergen Gross
2019-05-22  9:45 ` [PATCH 3/3] xen: build common/preempt.c only with CONFIG_DEBUG Juergen Gross
2019-05-22  9:45   ` [Xen-devel] " Juergen Gross
2019-05-22 10:20 [PATCH 2/3] xen: drop preempt_count() for non-debug builds Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522094549.28397-3-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).