kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kprobes: add sparse context annotation
@ 2010-08-06  8:12 Namhyung Kim
  2010-08-06  8:17 ` Namhyung Kim
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Namhyung Kim @ 2010-08-06  8:12 UTC (permalink / raw)
  To: kernel-janitors

this removes following warnings when build with C=1

 warning: context imbalance in 'kretprobe_hash_lock' - wrong count at exit
 warning: context imbalance in 'kretprobe_table_lock' - wrong count at exit
 warning: context imbalance in 'kretprobe_hash_unlock' - unexpected unlock
 warning: context imbalance in 'kretprobe_table_unlock' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@gmail.com>

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index c53aad5..89b7ef5 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -831,6 +831,7 @@ void __kprobes recycle_rp_inst(struct kretprobe_instance *ri,
 
 void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
 			 struct hlist_head **head, unsigned long *flags)
+__acquires(hlist_lock)
 {
 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
 	spinlock_t *hlist_lock;
@@ -842,6 +843,7 @@ void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
 
 static void __kprobes kretprobe_table_lock(unsigned long hash,
 	unsigned long *flags)
+__acquires(hlist_lock)
 {
 	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
 	spin_lock_irqsave(hlist_lock, *flags);
@@ -849,6 +851,7 @@ static void __kprobes kretprobe_table_lock(unsigned long hash,
 
 void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
 	unsigned long *flags)
+__releases(hlisk_lock)
 {
 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
 	spinlock_t *hlist_lock;
@@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
 
 static void __kprobes kretprobe_table_unlock(unsigned long hash,
        unsigned long *flags)
+__releases(hlisk_lock)
 {
 	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
 	spin_unlock_irqrestore(hlist_lock, *flags);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] kprobes: add sparse context annotation
  2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
@ 2010-08-06  8:17 ` Namhyung Kim
  2010-08-06  8:47 ` Masami Hiramatsu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2010-08-06  8:17 UTC (permalink / raw)
  To: kernel-janitors

this removes following warnings when build with C=1

 warning: context imbalance in 'kretprobe_hash_lock' - wrong count at exit
 warning: context imbalance in 'kretprobe_table_lock' - wrong count at exit
 warning: context imbalance in 'kretprobe_hash_unlock' - unexpected unlock
 warning: context imbalance in 'kretprobe_table_unlock' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@gmail.com>

---

oops.. there was an typo. apply this version instead.
Thanks.

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index c53aad5..6dd5359 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -831,6 +831,7 @@ void __kprobes recycle_rp_inst(struct kretprobe_instance *ri,
 
 void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
 			 struct hlist_head **head, unsigned long *flags)
+__acquires(hlist_lock)
 {
 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
 	spinlock_t *hlist_lock;
@@ -842,6 +843,7 @@ void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
 
 static void __kprobes kretprobe_table_lock(unsigned long hash,
 	unsigned long *flags)
+__acquires(hlist_lock)
 {
 	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
 	spin_lock_irqsave(hlist_lock, *flags);
@@ -849,6 +851,7 @@ static void __kprobes kretprobe_table_lock(unsigned long hash,
 
 void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
 	unsigned long *flags)
+__releases(hlist_lock)
 {
 	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
 	spinlock_t *hlist_lock;
@@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
 
 static void __kprobes kretprobe_table_unlock(unsigned long hash,
        unsigned long *flags)
+__releases(hlist_lock)
 {
 	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
 	spin_unlock_irqrestore(hlist_lock, *flags);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kprobes: add sparse context annotation
  2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
  2010-08-06  8:17 ` Namhyung Kim
@ 2010-08-06  8:47 ` Masami Hiramatsu
  2010-08-06  8:48 ` Masami Hiramatsu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2010-08-06  8:47 UTC (permalink / raw)
  To: kernel-janitors

Namhyung Kim wrote:
> this removes following warnings when build with C=1
> 
>  warning: context imbalance in 'kretprobe_hash_lock' - wrong count at exit
>  warning: context imbalance in 'kretprobe_table_lock' - wrong count at exit
>  warning: context imbalance in 'kretprobe_hash_unlock' - unexpected unlock
>  warning: context imbalance in 'kretprobe_table_unlock' - unexpected unlock

Good catch :)

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thanks!

> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index c53aad5..89b7ef5 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -831,6 +831,7 @@ void __kprobes recycle_rp_inst(struct kretprobe_instance *ri,
>  
>  void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
>  			 struct hlist_head **head, unsigned long *flags)
> +__acquires(hlist_lock)
>  {
>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>  	spinlock_t *hlist_lock;
> @@ -842,6 +843,7 @@ void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
>  
>  static void __kprobes kretprobe_table_lock(unsigned long hash,
>  	unsigned long *flags)
> +__acquires(hlist_lock)
>  {
>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>  	spin_lock_irqsave(hlist_lock, *flags);
> @@ -849,6 +851,7 @@ static void __kprobes kretprobe_table_lock(unsigned long hash,
>  
>  void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>  	unsigned long *flags)
> +__releases(hlisk_lock)
>  {
>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>  	spinlock_t *hlist_lock;
> @@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>  
>  static void __kprobes kretprobe_table_unlock(unsigned long hash,
>         unsigned long *flags)
> +__releases(hlisk_lock)
>  {
>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>  	spin_unlock_irqrestore(hlist_lock, *flags);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kprobes: add sparse context annotation
  2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
  2010-08-06  8:17 ` Namhyung Kim
  2010-08-06  8:47 ` Masami Hiramatsu
@ 2010-08-06  8:48 ` Masami Hiramatsu
  2010-08-06  8:53 ` Ananth N Mavinakayanahalli
  2010-09-02  4:15 ` Masami Hiramatsu
  4 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2010-08-06  8:48 UTC (permalink / raw)
  To: kernel-janitors

Ananth N Mavinakayanahalli wrote:
> On Fri, Aug 06, 2010 at 05:12:55PM +0900, Namhyung Kim wrote:
> 
>>  void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>>  	unsigned long *flags)
>> +__releases(hlisk_lock)
> 
> You surely meant hlist_lock, didn't you?
> 
>>  {
>>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>>  	spinlock_t *hlist_lock;
>> @@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>>
>>  static void __kprobes kretprobe_table_unlock(unsigned long hash,
>>         unsigned long *flags)
>> +__releases(hlisk_lock)
> 		^^^^^^
>>  {
>>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>>  	spin_unlock_irqrestore(hlist_lock, *flags);
>> -- 
>> 1.7.0.4

Oops, right...

-- 
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kprobes: add sparse context annotation
  2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
                   ` (2 preceding siblings ...)
  2010-08-06  8:48 ` Masami Hiramatsu
@ 2010-08-06  8:53 ` Ananth N Mavinakayanahalli
  2010-09-02  4:15 ` Masami Hiramatsu
  4 siblings, 0 replies; 6+ messages in thread
From: Ananth N Mavinakayanahalli @ 2010-08-06  8:53 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Aug 06, 2010 at 05:12:55PM +0900, Namhyung Kim wrote:

>  void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>  	unsigned long *flags)
> +__releases(hlisk_lock)

You surely meant hlist_lock, didn't you?

>  {
>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>  	spinlock_t *hlist_lock;
> @@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
> 
>  static void __kprobes kretprobe_table_unlock(unsigned long hash,
>         unsigned long *flags)
> +__releases(hlisk_lock)
		^^^^^^
>  {
>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>  	spin_unlock_irqrestore(hlist_lock, *flags);
> -- 
> 1.7.0.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kprobes: add sparse context annotation
  2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
                   ` (3 preceding siblings ...)
  2010-08-06  8:53 ` Ananth N Mavinakayanahalli
@ 2010-09-02  4:15 ` Masami Hiramatsu
  4 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2010-09-02  4:15 UTC (permalink / raw)
  To: kernel-janitors

(2010/08/06 17:17), Namhyung Kim wrote:
> this removes following warnings when build with C=1
> 
>  warning: context imbalance in 'kretprobe_hash_lock' - wrong count at exit
>  warning: context imbalance in 'kretprobe_table_lock' - wrong count at exit
>  warning: context imbalance in 'kretprobe_hash_unlock' - unexpected unlock
>  warning: context imbalance in 'kretprobe_table_unlock' - unexpected unlock
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>

Thanks for the fix!

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

> 
> ---
> 
> oops.. there was an typo. apply this version instead.
> Thanks.
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index c53aad5..6dd5359 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -831,6 +831,7 @@ void __kprobes recycle_rp_inst(struct kretprobe_instance *ri,
>  
>  void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
>  			 struct hlist_head **head, unsigned long *flags)
> +__acquires(hlist_lock)
>  {
>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>  	spinlock_t *hlist_lock;
> @@ -842,6 +843,7 @@ void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
>  
>  static void __kprobes kretprobe_table_lock(unsigned long hash,
>  	unsigned long *flags)
> +__acquires(hlist_lock)
>  {
>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>  	spin_lock_irqsave(hlist_lock, *flags);
> @@ -849,6 +851,7 @@ static void __kprobes kretprobe_table_lock(unsigned long hash,
>  
>  void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>  	unsigned long *flags)
> +__releases(hlist_lock)
>  {
>  	unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
>  	spinlock_t *hlist_lock;
> @@ -859,6 +862,7 @@ void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
>  
>  static void __kprobes kretprobe_table_unlock(unsigned long hash,
>         unsigned long *flags)
> +__releases(hlist_lock)
>  {
>  	spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
>  	spin_unlock_irqrestore(hlist_lock, *flags);


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-02  4:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06  8:12 [PATCH] kprobes: add sparse context annotation Namhyung Kim
2010-08-06  8:17 ` Namhyung Kim
2010-08-06  8:47 ` Masami Hiramatsu
2010-08-06  8:48 ` Masami Hiramatsu
2010-08-06  8:53 ` Ananth N Mavinakayanahalli
2010-09-02  4:15 ` Masami Hiramatsu

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).