All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
@ 2007-03-25 19:02 ` Alexey Dobriyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2007-03-25 18:13 UTC (permalink / raw)
  To: akpm; +Cc: ecashin, linux-kernel, kernel-janitors

Some drivers do register_chrdev() before lock or semaphore used in
corresponding file_operations is initialized.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 drivers/block/aoe/aoechr.c |    4 ++--
 drivers/char/tb0219.c      |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -246,13 +246,13 @@ aoechr_init(void)
 {
 	int n, i;
 
+	sema_init(&emsgs_sema, 0);
+	spin_lock_init(&emsgs_lock);
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) { 
 		printk(KERN_ERR "aoe: can't register char device\n");
 		return n;
 	}
-	sema_init(&emsgs_sema, 0);
-	spin_lock_init(&emsgs_lock);
 	aoe_class = class_create(THIS_MODULE, "aoe");
 	if (IS_ERR(aoe_class)) {
 		unregister_chrdev(AOE_MAJOR, "aoechr");
--- a/drivers/char/tb0219.c
+++ b/drivers/char/tb0219.c
@@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
 {
 	int retval;
 
+	spin_lock_init(&tb0219_lock);
+
 	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") = NULL)
 		return -EBUSY;
 
@@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
 		return retval;
 	}
 
-	spin_lock_init(&tb0219_lock);
-
 	old_machine_restart = _machine_restart;
 	_machine_restart = tb0219_restart;
 

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
@ 2007-03-25 19:02 ` Alexey Dobriyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2007-03-25 19:02 UTC (permalink / raw)
  To: akpm; +Cc: ecashin, linux-kernel, kernel-janitors

Some drivers do register_chrdev() before lock or semaphore used in
corresponding file_operations is initialized.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 drivers/block/aoe/aoechr.c |    4 ++--
 drivers/char/tb0219.c      |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -246,13 +246,13 @@ aoechr_init(void)
 {
 	int n, i;
 
+	sema_init(&emsgs_sema, 0);
+	spin_lock_init(&emsgs_lock);
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) { 
 		printk(KERN_ERR "aoe: can't register char device\n");
 		return n;
 	}
-	sema_init(&emsgs_sema, 0);
-	spin_lock_init(&emsgs_lock);
 	aoe_class = class_create(THIS_MODULE, "aoe");
 	if (IS_ERR(aoe_class)) {
 		unregister_chrdev(AOE_MAJOR, "aoechr");
--- a/drivers/char/tb0219.c
+++ b/drivers/char/tb0219.c
@@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
 {
 	int retval;
 
+	spin_lock_init(&tb0219_lock);
+
 	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") == NULL)
 		return -EBUSY;
 
@@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
 		return retval;
 	}
 
-	spin_lock_init(&tb0219_lock);
-
 	old_machine_restart = _machine_restart;
 	_machine_restart = tb0219_restart;
 


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

* Re: [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
  2007-03-25 19:02 ` Alexey Dobriyan
@ 2007-03-25 22:36   ` Andrew Morton
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2007-03-25 22:36 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: ecashin, linux-kernel, kernel-janitors

On Sun, 25 Mar 2007 23:02:21 +0400 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> Some drivers do register_chrdev() before lock or semaphore used in
> corresponding file_operations is initialized.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  drivers/block/aoe/aoechr.c |    4 ++--
>  drivers/char/tb0219.c      |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> --- a/drivers/block/aoe/aoechr.c
> +++ b/drivers/block/aoe/aoechr.c
> @@ -246,13 +246,13 @@ aoechr_init(void)
>  {
>  	int n, i;
>  
> +	sema_init(&emsgs_sema, 0);
> +	spin_lock_init(&emsgs_lock);
>  	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
>  	if (n < 0) { 
>  		printk(KERN_ERR "aoe: can't register char device\n");
>  		return n;
>  	}
> -	sema_init(&emsgs_sema, 0);
> -	spin_lock_init(&emsgs_lock);
>  	aoe_class = class_create(THIS_MODULE, "aoe");
>  	if (IS_ERR(aoe_class)) {
>  		unregister_chrdev(AOE_MAJOR, "aoechr");
> --- a/drivers/char/tb0219.c
> +++ b/drivers/char/tb0219.c
> @@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
>  {
>  	int retval;
>  
> +	spin_lock_init(&tb0219_lock);
> +
>  	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") == NULL)
>  		return -EBUSY;
>  
> @@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
>  		return retval;
>  	}
>  
> -	spin_lock_init(&tb0219_lock);
> -
>  	old_machine_restart = _machine_restart;
>  	_machine_restart = tb0219_restart;
>  

These locks can and should be initialised at compile-time.

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

* Re: [KJ] [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
@ 2007-03-25 22:36   ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2007-03-25 22:36 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: ecashin, linux-kernel, kernel-janitors

On Sun, 25 Mar 2007 23:02:21 +0400 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> Some drivers do register_chrdev() before lock or semaphore used in
> corresponding file_operations is initialized.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
> 
>  drivers/block/aoe/aoechr.c |    4 ++--
>  drivers/char/tb0219.c      |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> --- a/drivers/block/aoe/aoechr.c
> +++ b/drivers/block/aoe/aoechr.c
> @@ -246,13 +246,13 @@ aoechr_init(void)
>  {
>  	int n, i;
>  
> +	sema_init(&emsgs_sema, 0);
> +	spin_lock_init(&emsgs_lock);
>  	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
>  	if (n < 0) { 
>  		printk(KERN_ERR "aoe: can't register char device\n");
>  		return n;
>  	}
> -	sema_init(&emsgs_sema, 0);
> -	spin_lock_init(&emsgs_lock);
>  	aoe_class = class_create(THIS_MODULE, "aoe");
>  	if (IS_ERR(aoe_class)) {
>  		unregister_chrdev(AOE_MAJOR, "aoechr");
> --- a/drivers/char/tb0219.c
> +++ b/drivers/char/tb0219.c
> @@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
>  {
>  	int retval;
>  
> +	spin_lock_init(&tb0219_lock);
> +
>  	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") = NULL)
>  		return -EBUSY;
>  
> @@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
>  		return retval;
>  	}
>  
> -	spin_lock_init(&tb0219_lock);
> -
>  	old_machine_restart = _machine_restart;
>  	_machine_restart = tb0219_restart;
>  

These locks can and should be initialised at compile-time.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

* Re: [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
  2007-03-25 22:36   ` [KJ] " Andrew Morton
@ 2007-03-27 18:08     ` Alexey Dobriyan
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2007-03-27 18:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ecashin, linux-kernel, kernel-janitors

On Sun, Mar 25, 2007 at 02:36:09PM -0800, Andrew Morton wrote:
> On Sun, 25 Mar 2007 23:02:21 +0400 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > Some drivers do register_chrdev() before lock or semaphore used in
> > corresponding file_operations is initialized.

> > --- a/drivers/char/tb0219.c
> > +++ b/drivers/char/tb0219.c
> > @@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
> >  {
> >  	int retval;
> >
> > +	spin_lock_init(&tb0219_lock);
> > +
> >  	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") == NULL)
> >  		return -EBUSY;
> >
> > @@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
> >  		return retval;
> >  	}
> >
> > -	spin_lock_init(&tb0219_lock);
> > -
> >  	old_machine_restart = _machine_restart;
> >  	_machine_restart = tb0219_restart;
> >
>
> These locks can and should be initialised at compile-time.

Documentation mentions that

	- it [dynamic spinlock initialization] hurts automatic lock validators
	- it becomes intrusive for the realtime preemption patches

First reason is clearly bogus, how relevant is the second one?


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

* Re: [KJ] [PATCH] aoe, tb0219: fix late spin_lock_init() and friends
@ 2007-03-27 18:08     ` Alexey Dobriyan
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Dobriyan @ 2007-03-27 18:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ecashin, linux-kernel, kernel-janitors

On Sun, Mar 25, 2007 at 02:36:09PM -0800, Andrew Morton wrote:
> On Sun, 25 Mar 2007 23:02:21 +0400 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > Some drivers do register_chrdev() before lock or semaphore used in
> > corresponding file_operations is initialized.

> > --- a/drivers/char/tb0219.c
> > +++ b/drivers/char/tb0219.c
> > @@ -287,6 +287,8 @@ static int __devinit tb0219_probe(struct
> >  {
> >  	int retval;
> >
> > +	spin_lock_init(&tb0219_lock);
> > +
> >  	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") = NULL)
> >  		return -EBUSY;
> >
> > @@ -304,8 +306,6 @@ static int __devinit tb0219_probe(struct
> >  		return retval;
> >  	}
> >
> > -	spin_lock_init(&tb0219_lock);
> > -
> >  	old_machine_restart = _machine_restart;
> >  	_machine_restart = tb0219_restart;
> >
>
> These locks can and should be initialised at compile-time.

Documentation mentions that

	- it [dynamic spinlock initialization] hurts automatic lock validators
	- it becomes intrusive for the realtime preemption patches

First reason is clearly bogus, how relevant is the second one?

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2007-03-27 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-25 18:13 [KJ] [PATCH] aoe, tb0219: fix late spin_lock_init() and friends Alexey Dobriyan
2007-03-25 19:02 ` Alexey Dobriyan
2007-03-25 22:36 ` Andrew Morton
2007-03-25 22:36   ` [KJ] " Andrew Morton
2007-03-27 18:08   ` Alexey Dobriyan
2007-03-27 18:08     ` [KJ] " Alexey Dobriyan

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.