* [PATCH] init/main.c: fix sparse warnings: context imbalance
@ 2009-02-21 19:50 Hannes Eder
2009-02-22 11:30 ` Stefan Richter
0 siblings, 1 reply; 6+ messages in thread
From: Hannes Eder @ 2009-02-21 19:50 UTC (permalink / raw)
To: Ingo Molnar; +Cc: kernel-janitors, linux-kernel
Impact: Attribute function 'init_post' with __releases(...).
Fix this sparse warnings:
init/main.c:805:21: warning: context imbalance in 'init_post' - unexpected unlock
init/main.c:899:9: warning: context imbalance in 'kernel_init' - wrong count at exit
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
init/main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/init/main.c b/init/main.c
index 82456a9..fe53aa6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -803,6 +803,7 @@ int initmem_now_dynamic;
* makes it inline to init() and it becomes part of init.text section
*/
static noinline int init_post(void)
+ __releases(kernel_lock)
{
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] init/main.c: fix sparse warnings: context imbalance
2009-02-21 19:50 [PATCH] init/main.c: fix sparse warnings: context imbalance Hannes Eder
@ 2009-02-22 11:30 ` Stefan Richter
2009-02-22 11:36 ` Hannes Eder
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Richter @ 2009-02-22 11:30 UTC (permalink / raw)
To: Hannes Eder; +Cc: Ingo Molnar, kernel-janitors, linux-kernel
Hannes Eder wrote:
> Impact: Attribute function 'init_post' with __releases(...).
>
> Fix this sparse warnings:
It is not a fix, it's merely an annotation.
--
Stefan Richter
-=====-==--= --=- =-==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] init/main.c: fix sparse warnings: context imbalance
2009-02-22 11:30 ` Stefan Richter
@ 2009-02-22 11:36 ` Hannes Eder
2009-02-22 12:39 ` Stefan Richter
0 siblings, 1 reply; 6+ messages in thread
From: Hannes Eder @ 2009-02-22 11:36 UTC (permalink / raw)
To: Stefan Richter; +Cc: Ingo Molnar, kernel-janitors, linux-kernel
On Sun, Feb 22, 2009 at 12:30 PM, Stefan Richter
<stefanr@s5r6.in-berlin.de> wrote:
> Hannes Eder wrote:
>> Impact: Attribute function 'init_post' with __releases(...).
>>
>> Fix this sparse warnings:
>
> It is not a fix, it's merely an annotation.
This patch 'better word for fix's a warning reported by sparse. What
better wording would you suggest?
Thanks, -Hannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] init/main.c: fix sparse warnings: context imbalance
2009-02-22 11:36 ` Hannes Eder
@ 2009-02-22 12:39 ` Stefan Richter
2009-02-22 12:45 ` Stefan Richter
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Richter @ 2009-02-22 12:39 UTC (permalink / raw)
To: Hannes Eder; +Cc: Ingo Molnar, kernel-janitors, linux-kernel
Hannes Eder wrote:
> On Sun, Feb 22, 2009 at 12:30 PM, Stefan Richter
> <stefanr@s5r6.in-berlin.de> wrote:
>> It is not a fix, it's merely an annotation.
>
> This patch 'better word for fix's a warning reported by sparse. What
> better wording would you suggest?
"annotate init_post() as releasing the BKL" or whatever in the title,
furthermore "Removes the following sparse warnings: ..." in the changelog.
--
Stefan Richter
-=====-==--= --=- =-==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] init/main.c: fix sparse warnings: context imbalance
2009-02-22 12:39 ` Stefan Richter
@ 2009-02-22 12:45 ` Stefan Richter
2009-02-24 12:32 ` [PATCH v2] init/main.c: annotate 'init_post' with '__releases(kernel_lock)' Hannes Eder
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Richter @ 2009-02-22 12:45 UTC (permalink / raw)
To: Hannes Eder; +Cc: Ingo Molnar, kernel-janitors, linux-kernel
Stefan Richter wrote:
> Hannes Eder wrote:
>> On Sun, Feb 22, 2009 at 12:30 PM, Stefan Richter
>> <stefanr@s5r6.in-berlin.de> wrote:
>>> It is not a fix, it's merely an annotation.
>> This patch 'better word for fix's a warning reported by sparse. What
>> better wording would you suggest?
>
> "annotate init_post() as releasing the BKL" or whatever in the title,
> furthermore "Removes the following sparse warnings: ..." in the changelog.
PS: In some sense it is indeed a "fix" for the high-level problem that
sparse can't guess whether the context imbalance is correct or not. The
original warning from sparse was correct in itself. Your annotation
enables sparse to warn if problems outside the scope of the single
function occur (I guess). So it's more a maintainabiliy improvement
than a fix.
--
Stefan Richter
-=====-==--= --=- =-==-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] init/main.c: annotate 'init_post' with '__releases(kernel_lock)'
2009-02-22 12:45 ` Stefan Richter
@ 2009-02-24 12:32 ` Hannes Eder
0 siblings, 0 replies; 6+ messages in thread
From: Hannes Eder @ 2009-02-24 12:32 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Stefan Richter, kernel-janitors, linux-kernel
This fixes the following sparse warnings:
init/main.c:805:21: warning: context imbalance in 'init_post' - unexpected unlock
init/main.c:899:9: warning: context imbalance in 'kernel_init' - wrong count at exit
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
init/main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/init/main.c b/init/main.c
index 82456a9..fe53aa6 100644
--- a/init/main.c
+++ b/init/main.c
@@ -803,6 +803,7 @@ int initmem_now_dynamic;
* makes it inline to init() and it becomes part of init.text section
*/
static noinline int init_post(void)
+ __releases(kernel_lock)
{
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-02-24 12:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-21 19:50 [PATCH] init/main.c: fix sparse warnings: context imbalance Hannes Eder
2009-02-22 11:30 ` Stefan Richter
2009-02-22 11:36 ` Hannes Eder
2009-02-22 12:39 ` Stefan Richter
2009-02-22 12:45 ` Stefan Richter
2009-02-24 12:32 ` [PATCH v2] init/main.c: annotate 'init_post' with '__releases(kernel_lock)' Hannes Eder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®