* [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value
@ 2016-05-24 14:35 Huawei Xie
2016-05-25 10:47 ` Thomas Monjalon
2016-06-13 14:53 ` [dpdk-dev] [PATCH v2] virtio: fix crash loading virtio driver when devargs isn't specified Huawei Xie
0 siblings, 2 replies; 6+ messages in thread
From: Huawei Xie @ 2016-05-24 14:35 UTC (permalink / raw)
To: dev; +Cc: vincent.mc.li, yuanhan.liu, Huawei Xie
Fixes: ac5e1d838dc1 ("virtio: skip error when probing kernel managed device")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
drivers/net/virtio/virtio_pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 9cdca06..0e76db9 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -626,6 +626,7 @@ next:
* Return -1:
* if there is error mapping with VFIO/UIO.
* if port map error when driver type is KDRV_NONE.
+ * if whitelisted but driver type is KDRV_UNKNOWN.
* Return 1 if kernel driver is managing the device.
* Return 0 on success.
*/
@@ -651,7 +652,8 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
+ (!dev->devargs ||
+ dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
--
1.8.1.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value
2016-05-24 14:35 [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value Huawei Xie
@ 2016-05-25 10:47 ` Thomas Monjalon
2016-05-27 2:09 ` Yuanhan Liu
2016-06-13 14:53 ` [dpdk-dev] [PATCH v2] virtio: fix crash loading virtio driver when devargs isn't specified Huawei Xie
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2016-05-25 10:47 UTC (permalink / raw)
To: Huawei Xie; +Cc: dev, vincent.mc.li, yuanhan.liu
> - dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
> + (!dev->devargs ||
> + dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
Should the title be something like "fix crash ..."?
I would also add
Reported-by: Vincent Li <vincent.mc.li@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value
2016-05-25 10:47 ` Thomas Monjalon
@ 2016-05-27 2:09 ` Yuanhan Liu
2016-06-01 5:50 ` Xie, Huawei
0 siblings, 1 reply; 6+ messages in thread
From: Yuanhan Liu @ 2016-05-27 2:09 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: Huawei Xie, dev, vincent.mc.li
On Wed, May 25, 2016 at 12:47:30PM +0200, Thomas Monjalon wrote:
> > - dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
> > + (!dev->devargs ||
> > + dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
>
> Should the title be something like "fix crash ..."?
>
> I would also add
> Reported-by: Vincent Li <vincent.mc.li@gmail.com>
Huawei, the two are good comments (Thomas, thanks for the review, BTW :).
So, mind to send v2? BTW, I think this patch deserves some explanation,
say, why dev->devargs could be NULL.
--yliu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value
2016-05-27 2:09 ` Yuanhan Liu
@ 2016-06-01 5:50 ` Xie, Huawei
0 siblings, 0 replies; 6+ messages in thread
From: Xie, Huawei @ 2016-06-01 5:50 UTC (permalink / raw)
To: Yuanhan Liu, Thomas Monjalon; +Cc: dev, vincent.mc.li
On 5/27/2016 10:08 AM, Yuanhan Liu wrote:
> On Wed, May 25, 2016 at 12:47:30PM +0200, Thomas Monjalon wrote:
>>> - dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
>>> + (!dev->devargs ||
>>> + dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
>> Should the title be something like "fix crash ..."?
>>
>> I would also add
>> Reported-by: Vincent Li <vincent.mc.li@gmail.com>
> Huawei, the two are good comments (Thomas, thanks for the review, BTW :).
np.
>
> So, mind to send v2? BTW, I think this patch deserves some explanation,
> say, why dev->devargs could be NULL.
>
>
>
> --yliu
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v2] virtio: fix crash loading virtio driver when devargs isn't specified
2016-05-24 14:35 [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value Huawei Xie
2016-05-25 10:47 ` Thomas Monjalon
@ 2016-06-13 14:53 ` Huawei Xie
2016-06-14 13:19 ` Yuanhan Liu
1 sibling, 1 reply; 6+ messages in thread
From: Huawei Xie @ 2016-06-13 14:53 UTC (permalink / raw)
To: dev; +Cc: vincent.mc.li, yuanhan.liu, thomas.monjalon, Huawei Xie
We skip kernel managed virtio devices, if it isn't whitelisted.
Before checking if the virtio device is whitelisted, check if devargs is
specified.
Fixes: ac5e1d838dc1 ("virtio: skip error when probing kernel managed device")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Reported-by: Vincent Li <vincent.mc.li@gmail.com>
---
v2: - add reported-by
- reword subject
- reword commit message
---
drivers/net/virtio/virtio_pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index d0f2428..60ec4da 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -626,6 +626,7 @@ next:
* Return -1:
* if there is error mapping with VFIO/UIO.
* if port map error when driver type is KDRV_NONE.
+ * if whitelisted but driver type is KDRV_UNKNOWN.
* Return 1 if kernel driver is managing the device.
* Return 0 on success.
*/
@@ -651,7 +652,8 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw,
PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
if (legacy_virtio_resource_init(dev, hw, dev_flags) < 0) {
if (dev->kdrv == RTE_KDRV_UNKNOWN &&
- dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI) {
+ (!dev->devargs ||
+ dev->devargs->type != RTE_DEVTYPE_WHITELISTED_PCI)) {
PMD_INIT_LOG(INFO,
"skip kernel managed virtio device.");
return 1;
--
1.8.1.4
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-14 13:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-24 14:35 [dpdk-dev] [PATCH] virtio: check if devargs is NULL before checking its value Huawei Xie
2016-05-25 10:47 ` Thomas Monjalon
2016-05-27 2:09 ` Yuanhan Liu
2016-06-01 5:50 ` Xie, Huawei
2016-06-13 14:53 ` [dpdk-dev] [PATCH v2] virtio: fix crash loading virtio driver when devargs isn't specified Huawei Xie
2016-06-14 13:19 ` Yuanhan Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).