hw/core/bus.c | 28 +++-- hw/core/qdev.c | 73 +++++++++--- hw/net/virtio-net.c | 2 +- hw/scsi/scsi-bus.c | 262 ++++++++++++++++++++++++++--------------- hw/scsi/virtio-scsi.c | 27 +++-- hw/sd/core.c | 3 +- include/hw/qdev-core.h | 15 ++- include/hw/scsi/scsi.h | 1 + qdev-monitor.c | 22 ++++ 9 files changed, 299 insertions(+), 134 deletions(-)
This is my take on Maxim's patches. Mostly I am avoiding the problems with "scsi/scsi_bus: switch search direction in scsi_device_find" by adding a pre-realize callback for BusState that checks for the device address being in use. This makes it possible to avoid the tricky search for a preexisting device. Maxim Levitsky (7): scsi/scsi_bus: switch search direction in scsi_device_find device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add device-core: use RCU for list of children of a bus device-core: use atomic_set on .realized property scsi/scsi_bus: Add scsi_device_get virtio-scsi: use scsi_device_get scsi/scsi_bus: fix races in REPORT LUNS Paolo Bonzini (3): qdev: add "check if address free" callback for buses scsi: switch to bus->check_address scsi/scsi-bus: scsi_device_find: don't return unrealized devices hw/core/bus.c | 28 +++-- hw/core/qdev.c | 73 +++++++++--- hw/net/virtio-net.c | 2 +- hw/scsi/scsi-bus.c | 262 ++++++++++++++++++++++++++--------------- hw/scsi/virtio-scsi.c | 27 +++-- hw/sd/core.c | 3 +- include/hw/qdev-core.h | 15 ++- include/hw/scsi/scsi.h | 1 + qdev-monitor.c | 22 ++++ 9 files changed, 299 insertions(+), 134 deletions(-) -- 2.26.2
Patchew URL: https://patchew.org/QEMU/20200925172604.2142227-1-pbonzini@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200925172604.2142227-1-pbonzini@redhat.com
Subject: [PATCH 00/10] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
* [new tag] patchew/20200925172604.2142227-1-pbonzini@redhat.com -> patchew/20200925172604.2142227-1-pbonzini@redhat.com
Switched to a new branch 'test'
21c2380 scsi/scsi_bus: fix races in REPORT LUNS
aacd230 virtio-scsi: use scsi_device_get
f9f8f08 scsi/scsi_bus: Add scsi_device_get
c66050f scsi/scsi-bus: scsi_device_find: don't return unrealized devices
bb9fbd3 device-core: use atomic_set on .realized property
bd87593 device-core: use RCU for list of children of a bus
51a8ebe device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add
a595aa2 scsi/scsi_bus: switch search direction in scsi_device_find
6739a20 scsi: switch to bus->check_address
c4ed079 qdev: add "check if address free" callback for buses
=== OUTPUT BEGIN ===
1/10 Checking commit c4ed0795a36d (qdev: add "check if address free" callback for buses)
2/10 Checking commit 6739a205e683 (scsi: switch to bus->check_address)
ERROR: code indent should never use tabs
#53: FILE: hw/scsi/scsi-bus.c:137:
+^I^I^I^I int channel, int target, int lun,$
ERROR: code indent should never use tabs
#54: FILE: hw/scsi/scsi-bus.c:138:
+^I^I^I^I SCSIDevice **p_dev)$
WARNING: line over 80 characters
#69: FILE: hw/scsi/scsi-bus.c:153:
+static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **errp)
WARNING: line over 80 characters
#89: FILE: hw/scsi/scsi-bus.c:173:
+ if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) {
WARNING: line over 80 characters
#128: FILE: hw/scsi/scsi-bus.c:195:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL);
WARNING: line over 80 characters
#141: FILE: hw/scsi/scsi-bus.c:205:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL);
total: 2 errors, 4 warnings, 182 lines checked
Patch 2/10 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit a595aa288f19 (scsi/scsi_bus: switch search direction in scsi_device_find)
4/10 Checking commit 51a8ebe64c5f (device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add)
5/10 Checking commit bd87593ffb6e (device-core: use RCU for list of children of a bus)
6/10 Checking commit bb9fbd3d7a25 (device-core: use atomic_set on .realized property)
7/10 Checking commit c66050f657ae (scsi/scsi-bus: scsi_device_find: don't return unrealized devices)
8/10 Checking commit f9f8f0888e58 (scsi/scsi_bus: Add scsi_device_get)
9/10 Checking commit aacd2301cef8 (virtio-scsi: use scsi_device_get)
10/10 Checking commit 21c238042be7 (scsi/scsi_bus: fix races in REPORT LUNS)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200925172604.2142227-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Patchew URL: https://patchew.org/QEMU/20200925172604.2142227-1-pbonzini@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200925172604.2142227-1-pbonzini@redhat.com
Subject: [PATCH 00/10] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
- [tag update] patchew/20200925172604.2142227-1-pbonzini@redhat.com -> patchew/20200925172604.2142227-1-pbonzini@redhat.com
Switched to a new branch 'test'
9932c24 scsi/scsi_bus: fix races in REPORT LUNS
1b75dae virtio-scsi: use scsi_device_get
5cdf821 scsi/scsi_bus: Add scsi_device_get
47cdfc0 scsi/scsi-bus: scsi_device_find: don't return unrealized devices
75ce260 device-core: use atomic_set on .realized property
a417bc2 device-core: use RCU for list of children of a bus
8e81334 device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add
ec790ac scsi/scsi_bus: switch search direction in scsi_device_find
b9c2f95 scsi: switch to bus->check_address
0519c6e qdev: add "check if address free" callback for buses
=== OUTPUT BEGIN ===
1/10 Checking commit 0519c6ec5850 (qdev: add "check if address free" callback for buses)
2/10 Checking commit b9c2f95892cb (scsi: switch to bus->check_address)
ERROR: code indent should never use tabs
#53: FILE: hw/scsi/scsi-bus.c:137:
+^I^I^I^I int channel, int target, int lun,$
ERROR: code indent should never use tabs
#54: FILE: hw/scsi/scsi-bus.c:138:
+^I^I^I^I SCSIDevice **p_dev)$
WARNING: line over 80 characters
#69: FILE: hw/scsi/scsi-bus.c:153:
+static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **errp)
WARNING: line over 80 characters
#89: FILE: hw/scsi/scsi-bus.c:173:
+ if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) {
WARNING: line over 80 characters
#128: FILE: hw/scsi/scsi-bus.c:195:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL);
WARNING: line over 80 characters
#141: FILE: hw/scsi/scsi-bus.c:205:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL);
total: 2 errors, 4 warnings, 182 lines checked
Patch 2/10 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit ec790aca5ae9 (scsi/scsi_bus: switch search direction in scsi_device_find)
4/10 Checking commit 8e81334e7b46 (device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add)
5/10 Checking commit a417bc2b8f36 (device-core: use RCU for list of children of a bus)
6/10 Checking commit 75ce26036080 (device-core: use atomic_set on .realized property)
7/10 Checking commit 47cdfc0d2962 (scsi/scsi-bus: scsi_device_find: don't return unrealized devices)
8/10 Checking commit 5cdf82120022 (scsi/scsi_bus: Add scsi_device_get)
9/10 Checking commit 1b75daed11e0 (virtio-scsi: use scsi_device_get)
10/10 Checking commit 9932c24a76f7 (scsi/scsi_bus: fix races in REPORT LUNS)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200925172604.2142227-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Patchew URL: https://patchew.org/QEMU/20200925172604.2142227-1-pbonzini@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200925172604.2142227-1-pbonzini@redhat.com
Subject: [PATCH 00/10] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
c3f0c8f scsi/scsi_bus: fix races in REPORT LUNS
9de4834 virtio-scsi: use scsi_device_get
7da82c3 scsi/scsi_bus: Add scsi_device_get
eb46533 scsi/scsi-bus: scsi_device_find: don't return unrealized devices
8c11273 device-core: use atomic_set on .realized property
939dcba device-core: use RCU for list of children of a bus
0002336 device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add
efc35ef scsi/scsi_bus: switch search direction in scsi_device_find
0deb2b0 scsi: switch to bus->check_address
f57e102 qdev: add "check if address free" callback for buses
=== OUTPUT BEGIN ===
1/10 Checking commit f57e10207f21 (qdev: add "check if address free" callback for buses)
2/10 Checking commit 0deb2b0d8478 (scsi: switch to bus->check_address)
ERROR: code indent should never use tabs
#53: FILE: hw/scsi/scsi-bus.c:137:
+^I^I^I^I int channel, int target, int lun,$
ERROR: code indent should never use tabs
#54: FILE: hw/scsi/scsi-bus.c:138:
+^I^I^I^I SCSIDevice **p_dev)$
WARNING: line over 80 characters
#69: FILE: hw/scsi/scsi-bus.c:153:
+static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **errp)
WARNING: line over 80 characters
#89: FILE: hw/scsi/scsi-bus.c:173:
+ if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) {
WARNING: line over 80 characters
#128: FILE: hw/scsi/scsi-bus.c:195:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL);
WARNING: line over 80 characters
#141: FILE: hw/scsi/scsi-bus.c:205:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL);
total: 2 errors, 4 warnings, 182 lines checked
Patch 2/10 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit efc35ef5a2ad (scsi/scsi_bus: switch search direction in scsi_device_find)
4/10 Checking commit 000233693d95 (device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add)
5/10 Checking commit 939dcbab7a50 (device-core: use RCU for list of children of a bus)
6/10 Checking commit 8c112731188a (device-core: use atomic_set on .realized property)
7/10 Checking commit eb46533b2b49 (scsi/scsi-bus: scsi_device_find: don't return unrealized devices)
8/10 Checking commit 7da82c3d163f (scsi/scsi_bus: Add scsi_device_get)
9/10 Checking commit 9de4834b2871 (virtio-scsi: use scsi_device_get)
10/10 Checking commit c3f0c8f18f10 (scsi/scsi_bus: fix races in REPORT LUNS)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200925172604.2142227-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Patchew URL: https://patchew.org/QEMU/20200925172604.2142227-1-pbonzini@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200925172604.2142227-1-pbonzini@redhat.com
Subject: [PATCH 00/10] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Switched to a new branch 'test'
0791629 scsi/scsi_bus: fix races in REPORT LUNS
87daae1 virtio-scsi: use scsi_device_get
bca3b34 scsi/scsi_bus: Add scsi_device_get
f87edcf scsi/scsi-bus: scsi_device_find: don't return unrealized devices
4bcc453 device-core: use atomic_set on .realized property
ebe1f7c device-core: use RCU for list of children of a bus
6297cbe device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add
318e1e4 scsi/scsi_bus: switch search direction in scsi_device_find
5ad95de scsi: switch to bus->check_address
998aee1 qdev: add "check if address free" callback for buses
=== OUTPUT BEGIN ===
1/10 Checking commit 998aee1a14ad (qdev: add "check if address free" callback for buses)
2/10 Checking commit 5ad95de05950 (scsi: switch to bus->check_address)
ERROR: code indent should never use tabs
#53: FILE: hw/scsi/scsi-bus.c:137:
+^I^I^I^I int channel, int target, int lun,$
ERROR: code indent should never use tabs
#54: FILE: hw/scsi/scsi-bus.c:138:
+^I^I^I^I SCSIDevice **p_dev)$
WARNING: line over 80 characters
#69: FILE: hw/scsi/scsi-bus.c:153:
+static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **errp)
WARNING: line over 80 characters
#89: FILE: hw/scsi/scsi-bus.c:173:
+ if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) {
WARNING: line over 80 characters
#128: FILE: hw/scsi/scsi-bus.c:195:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL);
WARNING: line over 80 characters
#141: FILE: hw/scsi/scsi-bus.c:205:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL);
total: 2 errors, 4 warnings, 182 lines checked
Patch 2/10 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit 318e1e496e9e (scsi/scsi_bus: switch search direction in scsi_device_find)
4/10 Checking commit 6297cbe94121 (device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add)
5/10 Checking commit ebe1f7cd3ce0 (device-core: use RCU for list of children of a bus)
6/10 Checking commit 4bcc453b4b1c (device-core: use atomic_set on .realized property)
7/10 Checking commit f87edcfc20e5 (scsi/scsi-bus: scsi_device_find: don't return unrealized devices)
8/10 Checking commit bca3b34e3e66 (scsi/scsi_bus: Add scsi_device_get)
9/10 Checking commit 87daae1b9d04 (virtio-scsi: use scsi_device_get)
10/10 Checking commit 079162965856 (scsi/scsi_bus: fix races in REPORT LUNS)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200925172604.2142227-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Patchew URL: https://patchew.org/QEMU/20200925172604.2142227-1-pbonzini@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20200925172604.2142227-1-pbonzini@redhat.com
Subject: [PATCH 00/10] Fix scsi devices plug/unplug races w.r.t virtio-scsi iothread
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
From https://github.com/patchew-project/qemu
- [tag update] patchew/20200925172604.2142227-1-pbonzini@redhat.com -> patchew/20200925172604.2142227-1-pbonzini@redhat.com
Switched to a new branch 'test'
fbea547 scsi/scsi_bus: fix races in REPORT LUNS
8732528 virtio-scsi: use scsi_device_get
4cb91a6 scsi/scsi_bus: Add scsi_device_get
c91de0a scsi/scsi-bus: scsi_device_find: don't return unrealized devices
f9b2cb5 device-core: use atomic_set on .realized property
7c7d163 device-core: use RCU for list of children of a bus
568c8ae device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add
f594f95 scsi/scsi_bus: switch search direction in scsi_device_find
42b132a scsi: switch to bus->check_address
f0891a9 qdev: add "check if address free" callback for buses
=== OUTPUT BEGIN ===
1/10 Checking commit f0891a96af1b (qdev: add "check if address free" callback for buses)
2/10 Checking commit 42b132a31e18 (scsi: switch to bus->check_address)
ERROR: code indent should never use tabs
#53: FILE: hw/scsi/scsi-bus.c:137:
+^I^I^I^I int channel, int target, int lun,$
ERROR: code indent should never use tabs
#54: FILE: hw/scsi/scsi-bus.c:138:
+^I^I^I^I SCSIDevice **p_dev)$
WARNING: line over 80 characters
#69: FILE: hw/scsi/scsi-bus.c:153:
+static bool scsi_bus_check_address(BusState *qbus, DeviceState *qdev, Error **errp)
WARNING: line over 80 characters
#89: FILE: hw/scsi/scsi-bus.c:173:
+ if (!scsi_bus_is_address_free(bus, dev->channel, dev->id, dev->lun, &d)) {
WARNING: line over 80 characters
#128: FILE: hw/scsi/scsi-bus.c:195:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, ++id, dev->lun, NULL);
WARNING: line over 80 characters
#141: FILE: hw/scsi/scsi-bus.c:205:
+ is_free = scsi_bus_is_address_free(bus, dev->channel, dev->id, ++lun, NULL);
total: 2 errors, 4 warnings, 182 lines checked
Patch 2/10 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/10 Checking commit f594f95b4779 (scsi/scsi_bus: switch search direction in scsi_device_find)
4/10 Checking commit 568c8aea7113 (device_core: use drain_call_rcu in in hmp_device_del/qmp_device_add)
5/10 Checking commit 7c7d163add9c (device-core: use RCU for list of children of a bus)
6/10 Checking commit f9b2cb585972 (device-core: use atomic_set on .realized property)
7/10 Checking commit c91de0a97535 (scsi/scsi-bus: scsi_device_find: don't return unrealized devices)
8/10 Checking commit 4cb91a6d49f4 (scsi/scsi_bus: Add scsi_device_get)
9/10 Checking commit 87325282af2e (virtio-scsi: use scsi_device_get)
10/10 Checking commit fbea547fe6c6 (scsi/scsi_bus: fix races in REPORT LUNS)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20200925172604.2142227-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
© 2016 - 2026 Red Hat, Inc.