Skip to contentSkip to conversation

hw/misc/edu: add msi_uninit() for pci_edu_uninit()

PATCH Superseded Fei Li 5 participants 7 messages Jan 13, 2019 – Jan 14, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fei Li

author
#0 lore raw

PATCH 1/1 hw/misc/edu: add msi_uninit() for pci_edu_uninit()

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +1 -0
index cdcf550dd7..4feb7503de 100644
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
 {
     EduState *edu = EDU(pdev);
 
+    msi_uninit(pdev);
     qemu_mutex_lock(&edu->thr_mutex);
     edu->stopping = true;
     qemu_mutex_unlock(&edu->thr_mutex);
Signature · 1 line
2.17.2 (Apple Git-113)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
  hw/misc/edu.c | 1 +
  1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 373

Quoted 7 lines
hw/misc/edu.c +1 -0
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
  {
      EduState *edu = EDU(pdev);
 
+    msi_uninit(pdev);
      qemu_mutex_lock(&edu->thr_mutex);
      edu->stopping = true;
      qemu_mutex_unlock(&edu->thr_mutex);

Thanks,
Marcel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Fei Li
Quoted 19 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 370

Quoted 4 lines
hw/misc/edu.c +1 -0
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
 {
     EduState *edu = EDU(pdev);
 
+    msi_uninit(pdev);

It would be cleaner to me to call this after the join() since edu_fact_thread() could potentially use msi_*() helpers then the destructions follow the reverse order of init.

Quoted 6 lines
hw/misc/edu.c +0 -0
     qemu_mutex_lock(&edu->thr_mutex);
     edu->stopping = true;
     qemu_mutex_unlock(&edu->thr_mutex);
Signature · 1 line
2.17.2 (Apple Git-113)

Regards,

Signature · 1 line
Peter Xu
#3 lore raw
Quoted 23 lines · Peter Xu
Quoted 22 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
 {
     EduState *edu = EDU(pdev);
 
Quoted 5 lines

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 370

Quoted 1 line
hw/misc/edu.c +1 -0
+    msi_uninit(pdev);

It would be cleaner to me to call this after the join() since edu_fact_thread() could potentially use msi_*() helpers then the destructions follow the reverse order of init.

Destruction in reverse creation order is good practice.

This being the "QEMU educational PCI device", good practice is even more desirable.

Quoted 10 lines
Quoted 6 lines
hw/misc/edu.c +0 -0
     qemu_mutex_lock(&edu->thr_mutex);
     edu->stopping = true;
     qemu_mutex_unlock(&edu->thr_mutex);
Signature · 1 line
2.17.2 (Apple Git-113)

Regards,

#4 lore raw
Quoted 31 lines · Markus Armbruster
Quoted 23 lines · Peter Xu
Quoted 22 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
 {
     EduState *edu = EDU(pdev);
 
Quoted 5 lines

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 370

Quoted 1 line
hw/misc/edu.c +1 -0
+    msi_uninit(pdev);

It would be cleaner to me to call this after the join() since edu_fact_thread() could potentially use msi_*() helpers then the destructions follow the reverse order of init.

Quoted 4 lines

Destruction in reverse creation order is good practice.

This being the "QEMU educational PCI device", good practice is even more desirable.

Very persuasive. With that, I'd like to withdraw my excuse of "msi_uninit() is optional" too. :)

Fei, please feel free to pick my r-b if you want to repost, and IMHO you can also add:

Thanks,

Signature · 1 line
Peter Xu
#5 lore raw
Quoted 40 lines · Peter Xu
Quoted 31 lines · Markus Armbruster
Quoted 23 lines · Peter Xu
Quoted 22 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
 hw/misc/edu.c | 1 +
 1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
 {
     EduState *edu = EDU(pdev);
 
Quoted 5 lines

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 370

Quoted 1 line
hw/misc/edu.c +1 -0
+    msi_uninit(pdev);

It would be cleaner to me to call this after the join() since edu_fact_thread() could potentially use msi_*() helpers then the destructions follow the reverse order of init.

Quoted 4 lines

Destruction in reverse creation order is good practice.

This being the "QEMU educational PCI device", good practice is even more desirable.

Very persuasive. With that, I'd like to withdraw my excuse of "msi_uninit() is optional" too. :)

Quoted 7 lines

Fei, please feel free to pick my r-b if you want to repost, and IMHO you can also add:

Thanks,

Moving msi_uninit() after timer_del():

author
#6 lore raw
Quoted 41 lines · Philippe Mathieu-Daudé
Quoted 40 lines · Peter Xu
Quoted 25 lines · Markus Armbruster
Quoted 23 lines · Peter Xu
Quoted 22 lines · Fei Li

From: Fei Li <[email protected]>

Let's supplement the msi_uninit() when failing to realize the pci edu device.

Cc Markus Armbruster <[email protected]>
Cc Peter Xu <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Marcel Apfelbaum <[email protected]>
---
  hw/misc/edu.c | 1 +
  1 file changed, 1 insertion(+)
hw/misc/edu.c +0 -0
index cdcf550dd7..4feb7503de 100644
@@ -367,6 +367,7 @@ static void pci_edu_uninit(PCIDevice *pdev)
  {
      EduState *edu = EDU(pdev);
 
Quoted 8 lines
Quoted 4 lines

hw/misc/edu.c static void pci_edu_uninit(PCIDevice *pdev) · line 370

Quoted 1 line
hw/misc/edu.c +1 -0
+    msi_uninit(pdev);

It would be cleaner to me to call this after the join() since edu_fact_thread() could potentially use msi_*() helpers then the destructions follow the reverse order of init.

Destruction in reverse creation order is good practice.

This being the "QEMU educational PCI device", good practice is even more desirable.

Very persuasive. With that, I'd like to withdraw my excuse of "msi_uninit() is optional" too. :)

Fei, please feel free to pick my r-b if you want to repost, and IMHO you can also add:

Quoted 6 lines
Quoted 4 lines

Thanks,

Moving msi_uninit() after timer_del():

Ok, thanks all!

Will do the update and send a new version soon.

Have a nice day
Fei