All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Drivers: hv: util: don't forget to init host_ts.lock
@ 2017-02-15 14:07 ` Dexuan Cui
  0 siblings, 0 replies; 5+ messages in thread
From: Dexuan Cui @ 2017-02-15 14:07 UTC (permalink / raw)
  To: gregkh, driverdev-devel, KY Srinivasan, Haiyang Zhang, Stephen Hemminger
  Cc: Vitaly Kuznetsov, linux-kernel


Without the patch, I always get a "BUG: spinlock bad magic" warning.

Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
---

3716a49a81ba is the commit id in char-misc.git, since the patch hasn't
been in Linus's tree yet.

 drivers/hv/hv_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 098cd3d..60d763c 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -591,6 +591,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
 	if (!hyperv_cs)
 		return -ENODEV;
 
+	spin_lock_init(&host_ts.lock);
+
 	INIT_WORK(&wrk.work, hv_set_host_time);
 
 	/*
-- 
2.7.4

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

* [PATCH] Drivers: hv: util: don't forget to init host_ts.lock
@ 2017-02-15 14:07 ` Dexuan Cui
  0 siblings, 0 replies; 5+ messages in thread
From: Dexuan Cui @ 2017-02-15 14:07 UTC (permalink / raw)
  To: gregkh, driverdev-devel, KY Srinivasan, Haiyang Zhang, Stephen Hemminger
  Cc: linux-kernel


Without the patch, I always get a "BUG: spinlock bad magic" warning.

Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
---

3716a49a81ba is the commit id in char-misc.git, since the patch hasn't
been in Linus's tree yet.

 drivers/hv/hv_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 098cd3d..60d763c 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -591,6 +591,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
 	if (!hyperv_cs)
 		return -ENODEV;
 
+	spin_lock_init(&host_ts.lock);
+
 	INIT_WORK(&wrk.work, hv_set_host_time);
 
 	/*
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock
  2017-02-15 14:07 ` Dexuan Cui
  (?)
@ 2017-02-15 15:32 ` Stephen Hemminger
  2017-02-15 15:51   ` Dexuan Cui
  -1 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2017-02-15 15:32 UTC (permalink / raw)
  To: Dexuan Cui, gregkh, driverdev-devel, KY Srinivasan, Haiyang Zhang
  Cc: Vitaly Kuznetsov, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]

You could just use

static DEFINE_SPINLOCK(host_ts_lock);


which will do all the static initialization

________________________________
From: Dexuan Cui
Sent: Wednesday, February 15, 2017 6:07:32 AM
To: gregkh@linuxfoundation.org; driverdev-devel@linuxdriverproject.org; KY Srinivasan; Haiyang Zhang; Stephen Hemminger
Cc: Vitaly Kuznetsov; linux-kernel@vger.kernel.org
Subject: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock


Without the patch, I always get a "BUG: spinlock bad magic" warning.

Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
---

3716a49a81ba is the commit id in char-misc.git, since the patch hasn't
been in Linus's tree yet.

 drivers/hv/hv_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 098cd3d..60d763c 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -591,6 +591,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
         if (!hyperv_cs)
                 return -ENODEV;

+       spin_lock_init(&host_ts.lock);
+
         INIT_WORK(&wrk.work, hv_set_host_time);

         /*
--
2.7.4


[-- Attachment #2: Type: text/html, Size: 2855 bytes --]

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

* RE: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock
  2017-02-15 15:32 ` Stephen Hemminger
@ 2017-02-15 15:51   ` Dexuan Cui
  2017-02-15 15:57     ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Dexuan Cui @ 2017-02-15 15:51 UTC (permalink / raw)
  To: Stephen Hemminger, gregkh, driverdev-devel, KY Srinivasan, Haiyang Zhang
  Cc: Vitaly Kuznetsov, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]

Hi Stephen,
Do you mean replacing the global variable host_ts's lock field with a new global variable host_ts_lock?
This would require us to update all the references of host_ts.lock.
IMO the explicit spin_lock_init() in the patch is better. :)

Thanks,
-- Dexuan

From: Stephen Hemminger
Sent: Wednesday, February 15, 2017 23:33
To: Dexuan Cui <decui@microsoft.com>; gregkh@linuxfoundation.org; driverdev-devel@linuxdriverproject.org; KY Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock


You could just use

static DEFINE_SPINLOCK(host_ts_lock);



which will do all the static initialization

________________________________
From: Dexuan Cui
Sent: Wednesday, February 15, 2017 6:07:32 AM
To: gregkh@linuxfoundation.org<mailto:gregkh@linuxfoundation.org>; driverdev-devel@linuxdriverproject.org<mailto:driverdev-devel@linuxdriverproject.org>; KY Srinivasan; Haiyang Zhang; Stephen Hemminger
Cc: Vitaly Kuznetsov; linux-kernel@vger.kernel.org<mailto:linux-kernel@vger.kernel.org>
Subject: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock


Without the patch, I always get a "BUG: spinlock bad magic" warning.

Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Dexuan Cui <decui@microsoft.com<mailto:decui@microsoft.com>>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com<mailto:vkuznets@redhat.com>>
Cc: "K. Y. Srinivasan" <kys@microsoft.com<mailto:kys@microsoft.com>>
Cc: Haiyang Zhang <haiyangz@microsoft.com<mailto:haiyangz@microsoft.com>>
Cc: Stephen Hemminger <sthemmin@microsoft.com<mailto:sthemmin@microsoft.com>>
---

3716a49a81ba is the commit id in char-misc.git, since the patch hasn't
been in Linus's tree yet.

 drivers/hv/hv_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 098cd3d..60d763c 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -591,6 +591,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
         if (!hyperv_cs)
                 return -ENODEV;

+       spin_lock_init(&host_ts.lock);
+
         INIT_WORK(&wrk.work, hv_set_host_time);

         /*
--
2.7.4

[-- Attachment #2: Type: text/html, Size: 8109 bytes --]

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

* Re: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock
  2017-02-15 15:51   ` Dexuan Cui
@ 2017-02-15 15:57     ` Stephen Hemminger
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2017-02-15 15:57 UTC (permalink / raw)
  To: Dexuan Cui, gregkh, driverdev-devel, KY Srinivasan, Haiyang Zhang
  Cc: Vitaly Kuznetsov, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2861 bytes --]

Either way. I didn't go back and look at the origianl patch (till now). I just prefer initializers to code if possible. Your patch should go in.


________________________________
From: Dexuan Cui
Sent: Wednesday, February 15, 2017 7:51 AM
To: Stephen Hemminger; gregkh@linuxfoundation.org; driverdev-devel@linuxdriverproject.org; KY Srinivasan; Haiyang Zhang
Cc: Vitaly Kuznetsov; linux-kernel@vger.kernel.org
Subject: RE: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock


Hi Stephen,

Do you mean replacing the global variable host_ts’s lock field with a new global variable host_ts_lock?

This would require us to update all the references of host_ts.lock.

IMO the explicit spin_lock_init() in the patch is better. :)



Thanks,

-- Dexuan



From: Stephen Hemminger
Sent: Wednesday, February 15, 2017 23:33
To: Dexuan Cui <decui@microsoft.com>; gregkh@linuxfoundation.org; driverdev-devel@linuxdriverproject.org; KY Srinivasan <kys@microsoft.com>; Haiyang Zhang <haiyangz@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock



You could just use

static DEFINE_SPINLOCK(host_ts_lock);



which will do all the static initialization

________________________________

From: Dexuan Cui
Sent: Wednesday, February 15, 2017 6:07:32 AM
To: gregkh@linuxfoundation.org<mailto:gregkh@linuxfoundation.org>; driverdev-devel@linuxdriverproject.org<mailto:driverdev-devel@linuxdriverproject.org>; KY Srinivasan; Haiyang Zhang; Stephen Hemminger
Cc: Vitaly Kuznetsov; linux-kernel@vger.kernel.org<mailto:linux-kernel@vger.kernel.org>
Subject: [PATCH] Drivers: hv: util: don't forget to init host_ts.lock



Without the patch, I always get a "BUG: spinlock bad magic" warning.

Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source")
Signed-off-by: Dexuan Cui <decui@microsoft.com<mailto:decui@microsoft.com>>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com<mailto:vkuznets@redhat.com>>
Cc: "K. Y. Srinivasan" <kys@microsoft.com<mailto:kys@microsoft.com>>
Cc: Haiyang Zhang <haiyangz@microsoft.com<mailto:haiyangz@microsoft.com>>
Cc: Stephen Hemminger <sthemmin@microsoft.com<mailto:sthemmin@microsoft.com>>
---

3716a49a81ba is the commit id in char-misc.git, since the patch hasn't
been in Linus's tree yet.

 drivers/hv/hv_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 098cd3d..60d763c 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -591,6 +591,8 @@ static int hv_timesync_init(struct hv_util_service *srv)
         if (!hyperv_cs)
                 return -ENODEV;

+       spin_lock_init(&host_ts.lock);
+
         INIT_WORK(&wrk.work, hv_set_host_time);

         /*
--
2.7.4

[-- Attachment #2: Type: text/html, Size: 8354 bytes --]

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

end of thread, other threads:[~2017-02-15 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 14:07 [PATCH] Drivers: hv: util: don't forget to init host_ts.lock Dexuan Cui
2017-02-15 14:07 ` Dexuan Cui
2017-02-15 15:32 ` Stephen Hemminger
2017-02-15 15:51   ` Dexuan Cui
2017-02-15 15:57     ` Stephen Hemminger

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.