All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zhong <zhong@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	PowerPC email list <linuxppc-dev@lists.ozlabs.org>,
	Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH v2 powerpc] fix unpaired __trace_hcall_entry and __trace_hcall_exit
Date: Sun, 08 Jan 2012 11:54:52 +0800	[thread overview]
Message-ID: <1325994892.5482.10.camel@ThinkPad-T61> (raw)
In-Reply-To: <1325552057.23910.5.camel@pasglop>

On Tue, 2012-01-03 at 11:54 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2011-12-19 at 10:06 +0800, Li Zhong wrote:
> > Unpaired calling of __trace_hcall_entry and __trace_hcall_exit could
> > cause incorrect preempt count. And it might happen as the global
> > variable hcall_tracepoint_refcount is checked separately before calling
> > them. 
> > 
> > I don't know much about the powerpc arch. But the idea here is to store
> > the hcall_tracepoint_refcount locally, so __trace_hcall_entry and
> > __trace_hcall_exit will be called or not called in pair by checking the
> > same value. 
> 
> Can you re-use an existing spot in the stack frame rather than adding
> this entry ? There's plenty of unused spots :-) For example the link
> editor doubleword is never going to be used in that function, we could
> hijack it safely. It would make the patch (and the code) simpler.
> 
> Cheers,
> Ben.

Hi Ben, 

Thank you for the suggestion. Below is the updated version, much less
code changes :) Would you please help review again to see whether my
understanding is correct? 

Thanks,
Zhong

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/hvCall.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall.S
b/arch/powerpc/platforms/pseries/hvCall.S
index fd05fde..3ce73d0 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -36,6 +36,7 @@ BEGIN_FTR_SECTION;						\
 	b	1f;						\
 END_FTR_SECTION(0, 1);						\
 	ld      r12,hcall_tracepoint_refcount@toc(r2);		\
+	std	r12,32(r1);					\
 	cmpdi	r12,0;						\
 	beq+	1f;						\
 	mflr	r0;						\
@@ -74,7 +75,7 @@ END_FTR_SECTION(0, 1);						\
 BEGIN_FTR_SECTION;						\
 	b	1f;						\
 END_FTR_SECTION(0, 1);						\
-	ld      r12,hcall_tracepoint_refcount@toc(r2);		\
+	ld      r12,32(r1);					\
 	cmpdi	r12,0;						\
 	beq+	1f;						\
 	mflr	r0;						\
-- 
1.7.5.4


WARNING: multiple messages have this Message-ID (diff)
From: Li Zhong <zhong@linux.vnet.ibm.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: PowerPC email list <linuxppc-dev@lists.ozlabs.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Paul Mackerras <paulus@samba.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH v2 powerpc] fix unpaired __trace_hcall_entry and __trace_hcall_exit
Date: Sun, 08 Jan 2012 11:54:52 +0800	[thread overview]
Message-ID: <1325994892.5482.10.camel@ThinkPad-T61> (raw)
In-Reply-To: <1325552057.23910.5.camel@pasglop>

On Tue, 2012-01-03 at 11:54 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2011-12-19 at 10:06 +0800, Li Zhong wrote:
> > Unpaired calling of __trace_hcall_entry and __trace_hcall_exit could
> > cause incorrect preempt count. And it might happen as the global
> > variable hcall_tracepoint_refcount is checked separately before calling
> > them. 
> > 
> > I don't know much about the powerpc arch. But the idea here is to store
> > the hcall_tracepoint_refcount locally, so __trace_hcall_entry and
> > __trace_hcall_exit will be called or not called in pair by checking the
> > same value. 
> 
> Can you re-use an existing spot in the stack frame rather than adding
> this entry ? There's plenty of unused spots :-) For example the link
> editor doubleword is never going to be used in that function, we could
> hijack it safely. It would make the patch (and the code) simpler.
> 
> Cheers,
> Ben.

Hi Ben, 

Thank you for the suggestion. Below is the updated version, much less
code changes :) Would you please help review again to see whether my
understanding is correct? 

Thanks,
Zhong

Reported-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/hvCall.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall.S
b/arch/powerpc/platforms/pseries/hvCall.S
index fd05fde..3ce73d0 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -36,6 +36,7 @@ BEGIN_FTR_SECTION;						\
 	b	1f;						\
 END_FTR_SECTION(0, 1);						\
 	ld      r12,hcall_tracepoint_refcount@toc(r2);		\
+	std	r12,32(r1);					\
 	cmpdi	r12,0;						\
 	beq+	1f;						\
 	mflr	r0;						\
@@ -74,7 +75,7 @@ END_FTR_SECTION(0, 1);						\
 BEGIN_FTR_SECTION;						\
 	b	1f;						\
 END_FTR_SECTION(0, 1);						\
-	ld      r12,hcall_tracepoint_refcount@toc(r2);		\
+	ld      r12,32(r1);					\
 	cmpdi	r12,0;						\
 	beq+	1f;						\
 	mflr	r0;						\
-- 
1.7.5.4

  reply	other threads:[~2012-01-08  3:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19  2:06 [PATCH powerpc] fix unpaired __trace_hcall_entry and __trace_hcall_exit Li Zhong
2011-12-19  2:06 ` Li Zhong
2012-01-03  0:54 ` Benjamin Herrenschmidt
2012-01-03  0:54   ` Benjamin Herrenschmidt
2012-01-08  3:54   ` Li Zhong [this message]
2012-01-08  3:54     ` [PATCH v2 " Li Zhong

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=1325994892.5482.10.camel@ThinkPad-T61 \
    --to=zhong@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.