* [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
@ 2013-10-02 10:23 Andre Richter
2013-10-02 10:35 ` Gleb Natapov
2013-10-03 8:48 ` Gleb Natapov
0 siblings, 2 replies; 6+ messages in thread
From: Andre Richter @ 2013-10-02 10:23 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, linux-kernel, Andre Richter
When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
including the BDF notation of the respective device. Currently, the BDF
notation does not have the commonly used leading zeros. This produces
messages like "assign device 0:1:8.0", which look strange at first sight.
The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
and also inserts "kvm" into the debug message, so that it is obvious where
the message comes from. Also reduces LoC.
Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
---
virt/kvm/iommu.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 72a130b..a3b1410 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
- printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
- assigned_dev->host_segnr,
- assigned_dev->host_busnr,
- PCI_SLOT(assigned_dev->host_devfn),
- PCI_FUNC(assigned_dev->host_devfn));
+ dev_info(&pdev->dev, "kvm assign device\n");
return 0;
out_unmap:
@@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
- printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
- assigned_dev->host_segnr,
- assigned_dev->host_busnr,
- PCI_SLOT(assigned_dev->host_devfn),
- PCI_FUNC(assigned_dev->host_devfn));
+ dev_info(&pdev->dev, "kvm deassign device\n");
return 0;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
2013-10-02 10:23 [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages Andre Richter
@ 2013-10-02 10:35 ` Gleb Natapov
2013-10-02 15:41 ` Alex Williamson
2013-10-03 8:48 ` Gleb Natapov
1 sibling, 1 reply; 6+ messages in thread
From: Gleb Natapov @ 2013-10-02 10:35 UTC (permalink / raw)
To: Andre Richter; +Cc: Paolo Bonzini, kvm, linux-kernel, Alex Williamson
On Wed, Oct 02, 2013 at 12:23:26PM +0200, Andre Richter wrote:
> When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
> including the BDF notation of the respective device. Currently, the BDF
> notation does not have the commonly used leading zeros. This produces
> messages like "assign device 0:1:8.0", which look strange at first sight.
>
> The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
> and also inserts "kvm" into the debug message, so that it is obvious where
> the message comes from. Also reduces LoC.
Legacy assigned device is deprecated, but this looks nice enough to
apply. Alex can you glance at it?
>
> Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
> ---
> virt/kvm/iommu.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 72a130b..a3b1410 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
>
> pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
>
> - printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
> - assigned_dev->host_segnr,
> - assigned_dev->host_busnr,
> - PCI_SLOT(assigned_dev->host_devfn),
> - PCI_FUNC(assigned_dev->host_devfn));
> + dev_info(&pdev->dev, "kvm assign device\n");
>
> return 0;
> out_unmap:
> @@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
>
> pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
>
> - printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
> - assigned_dev->host_segnr,
> - assigned_dev->host_busnr,
> - PCI_SLOT(assigned_dev->host_devfn),
> - PCI_FUNC(assigned_dev->host_devfn));
> + dev_info(&pdev->dev, "kvm deassign device\n");
>
> return 0;
> }
> --
> 1.8.1.2
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
2013-10-02 10:35 ` Gleb Natapov
@ 2013-10-02 15:41 ` Alex Williamson
2013-10-02 19:08 ` Andre Richter
0 siblings, 1 reply; 6+ messages in thread
From: Alex Williamson @ 2013-10-02 15:41 UTC (permalink / raw)
To: Gleb Natapov; +Cc: Andre Richter, Paolo Bonzini, kvm, linux-kernel
On Wed, 2013-10-02 at 13:35 +0300, Gleb Natapov wrote:
> On Wed, Oct 02, 2013 at 12:23:26PM +0200, Andre Richter wrote:
> > When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
> > including the BDF notation of the respective device. Currently, the BDF
> > notation does not have the commonly used leading zeros. This produces
> > messages like "assign device 0:1:8.0", which look strange at first sight.
> >
> > The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
> > and also inserts "kvm" into the debug message, so that it is obvious where
> > the message comes from. Also reduces LoC.
> Legacy assigned device is deprecated, but this looks nice enough to
> apply. Alex can you glance at it?
Seems ok to me, my only question would be why are we promoting this from
KERN_DEBUG to KERN_INFO. We could use dev_dbg() to maintain the same
kernel log level. A nice feature of either is that it prints out the
attached driver so we can see in dmesg whether the device is attached to
a host driver, nothing, or pci-stub. Thanks,
Alex
> >
> > Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
> > ---
> > virt/kvm/iommu.c | 12 ++----------
> > 1 file changed, 2 insertions(+), 10 deletions(-)
> >
> > diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> > index 72a130b..a3b1410 100644
> > --- a/virt/kvm/iommu.c
> > +++ b/virt/kvm/iommu.c
> > @@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
> >
> > pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
> >
> > - printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
> > - assigned_dev->host_segnr,
> > - assigned_dev->host_busnr,
> > - PCI_SLOT(assigned_dev->host_devfn),
> > - PCI_FUNC(assigned_dev->host_devfn));
> > + dev_info(&pdev->dev, "kvm assign device\n");
> >
> > return 0;
> > out_unmap:
> > @@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
> >
> > pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
> >
> > - printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
> > - assigned_dev->host_segnr,
> > - assigned_dev->host_busnr,
> > - PCI_SLOT(assigned_dev->host_devfn),
> > - PCI_FUNC(assigned_dev->host_devfn));
> > + dev_info(&pdev->dev, "kvm deassign device\n");
> >
> > return 0;
> > }
> > --
> > 1.8.1.2
>
> --
> Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
2013-10-02 15:41 ` Alex Williamson
@ 2013-10-02 19:08 ` Andre Richter
2013-10-02 19:58 ` Alex Williamson
0 siblings, 1 reply; 6+ messages in thread
From: Andre Richter @ 2013-10-02 19:08 UTC (permalink / raw)
To: Alex Williamson; +Cc: Gleb Natapov, Paolo Bonzini, kvm, linux-kernel
2013/10/2 Alex Williamson <alex.williamson@redhat.com>:
> On Wed, 2013-10-02 at 13:35 +0300, Gleb Natapov wrote:
>> On Wed, Oct 02, 2013 at 12:23:26PM +0200, Andre Richter wrote:
>> > When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
>> > including the BDF notation of the respective device. Currently, the BDF
>> > notation does not have the commonly used leading zeros. This produces
>> > messages like "assign device 0:1:8.0", which look strange at first sight.
>> >
>> > The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
>> > and also inserts "kvm" into the debug message, so that it is obvious where
>> > the message comes from. Also reduces LoC.
>> Legacy assigned device is deprecated, but this looks nice enough to
>> apply. Alex can you glance at it?
>
> Seems ok to me, my only question would be why are we promoting this from
> KERN_DEBUG to KERN_INFO. We could use dev_dbg() to maintain the same
> kernel log level. A nice feature of either is that it prints out the
> attached driver so we can see in dmesg whether the device is attached to
> a host driver, nothing, or pci-stub. Thanks,
>
> Alex
I made it dev_info() because on my test system, dev_dbg() did not show
up in dmesg, whereas
the original printk(KERN_DEBUG ...) did. I guess dev_dbg() was
stripped due to compiling without DEBUG?
Therefore, I found dev_info() to better mimic the original behavior. I
can change it to dev_dbg() if you wish?
Andre
>
>> >
>> > Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
>> > ---
>> > virt/kvm/iommu.c | 12 ++----------
>> > 1 file changed, 2 insertions(+), 10 deletions(-)
>> >
>> > diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
>> > index 72a130b..a3b1410 100644
>> > --- a/virt/kvm/iommu.c
>> > +++ b/virt/kvm/iommu.c
>> > @@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
>> >
>> > pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
>> >
>> > - printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
>> > - assigned_dev->host_segnr,
>> > - assigned_dev->host_busnr,
>> > - PCI_SLOT(assigned_dev->host_devfn),
>> > - PCI_FUNC(assigned_dev->host_devfn));
>> > + dev_info(&pdev->dev, "kvm assign device\n");
>> >
>> > return 0;
>> > out_unmap:
>> > @@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
>> >
>> > pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
>> >
>> > - printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
>> > - assigned_dev->host_segnr,
>> > - assigned_dev->host_busnr,
>> > - PCI_SLOT(assigned_dev->host_devfn),
>> > - PCI_FUNC(assigned_dev->host_devfn));
>> > + dev_info(&pdev->dev, "kvm deassign device\n");
>> >
>> > return 0;
>> > }
>> > --
>> > 1.8.1.2
>>
>> --
>> Gleb.
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
2013-10-02 19:08 ` Andre Richter
@ 2013-10-02 19:58 ` Alex Williamson
0 siblings, 0 replies; 6+ messages in thread
From: Alex Williamson @ 2013-10-02 19:58 UTC (permalink / raw)
To: Andre Richter; +Cc: Gleb Natapov, Paolo Bonzini, kvm, linux-kernel
On Wed, 2013-10-02 at 21:08 +0200, Andre Richter wrote:
> 2013/10/2 Alex Williamson <alex.williamson@redhat.com>:
> > On Wed, 2013-10-02 at 13:35 +0300, Gleb Natapov wrote:
> >> On Wed, Oct 02, 2013 at 12:23:26PM +0200, Andre Richter wrote:
> >> > When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
> >> > including the BDF notation of the respective device. Currently, the BDF
> >> > notation does not have the commonly used leading zeros. This produces
> >> > messages like "assign device 0:1:8.0", which look strange at first sight.
> >> >
> >> > The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
> >> > and also inserts "kvm" into the debug message, so that it is obvious where
> >> > the message comes from. Also reduces LoC.
> >> Legacy assigned device is deprecated, but this looks nice enough to
> >> apply. Alex can you glance at it?
> >
> > Seems ok to me, my only question would be why are we promoting this from
> > KERN_DEBUG to KERN_INFO. We could use dev_dbg() to maintain the same
> > kernel log level. A nice feature of either is that it prints out the
> > attached driver so we can see in dmesg whether the device is attached to
> > a host driver, nothing, or pci-stub. Thanks,
> >
> > Alex
>
> I made it dev_info() because on my test system, dev_dbg() did not show
> up in dmesg, whereas
> the original printk(KERN_DEBUG ...) did. I guess dev_dbg() was
> stripped due to compiling without DEBUG?
> Therefore, I found dev_info() to better mimic the original behavior. I
> can change it to dev_dbg() if you wish?
Ah, dev_dbg is dynamic. I guess I don't really mind the change, host
drivers print out more.
Acked-by: Alex Williamson <alex.williamson@redhat.com>
> >
> >> >
> >> > Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
> >> > ---
> >> > virt/kvm/iommu.c | 12 ++----------
> >> > 1 file changed, 2 insertions(+), 10 deletions(-)
> >> >
> >> > diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> >> > index 72a130b..a3b1410 100644
> >> > --- a/virt/kvm/iommu.c
> >> > +++ b/virt/kvm/iommu.c
> >> > @@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
> >> >
> >> > pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
> >> >
> >> > - printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
> >> > - assigned_dev->host_segnr,
> >> > - assigned_dev->host_busnr,
> >> > - PCI_SLOT(assigned_dev->host_devfn),
> >> > - PCI_FUNC(assigned_dev->host_devfn));
> >> > + dev_info(&pdev->dev, "kvm assign device\n");
> >> >
> >> > return 0;
> >> > out_unmap:
> >> > @@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
> >> >
> >> > pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
> >> >
> >> > - printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
> >> > - assigned_dev->host_segnr,
> >> > - assigned_dev->host_busnr,
> >> > - PCI_SLOT(assigned_dev->host_devfn),
> >> > - PCI_FUNC(assigned_dev->host_devfn));
> >> > + dev_info(&pdev->dev, "kvm deassign device\n");
> >> >
> >> > return 0;
> >> > }
> >> > --
> >> > 1.8.1.2
> >>
> >> --
> >> Gleb.
> >
> >
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages
2013-10-02 10:23 [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages Andre Richter
2013-10-02 10:35 ` Gleb Natapov
@ 2013-10-03 8:48 ` Gleb Natapov
1 sibling, 0 replies; 6+ messages in thread
From: Gleb Natapov @ 2013-10-03 8:48 UTC (permalink / raw)
To: Andre Richter; +Cc: Paolo Bonzini, kvm, linux-kernel
On Wed, Oct 02, 2013 at 12:23:26PM +0200, Andre Richter wrote:
> When KVM (de)assigns PCI(e) devices to VMs, a debug message is printed
> including the BDF notation of the respective device. Currently, the BDF
> notation does not have the commonly used leading zeros. This produces
> messages like "assign device 0:1:8.0", which look strange at first sight.
>
> The patch fixes this by exchanging the printk(KERN_DEBUG ...) with dev_info()
> and also inserts "kvm" into the debug message, so that it is obvious where
> the message comes from. Also reduces LoC.
>
> Signed-off-by: Andre Richter <andre.o.richter@gmail.com>
Applied, thanks.
> ---
> virt/kvm/iommu.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 72a130b..a3b1410 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -190,11 +190,7 @@ int kvm_assign_device(struct kvm *kvm,
>
> pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
>
> - printk(KERN_DEBUG "assign device %x:%x:%x.%x\n",
> - assigned_dev->host_segnr,
> - assigned_dev->host_busnr,
> - PCI_SLOT(assigned_dev->host_devfn),
> - PCI_FUNC(assigned_dev->host_devfn));
> + dev_info(&pdev->dev, "kvm assign device\n");
>
> return 0;
> out_unmap:
> @@ -220,11 +216,7 @@ int kvm_deassign_device(struct kvm *kvm,
>
> pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
>
> - printk(KERN_DEBUG "deassign device %x:%x:%x.%x\n",
> - assigned_dev->host_segnr,
> - assigned_dev->host_busnr,
> - PCI_SLOT(assigned_dev->host_devfn),
> - PCI_FUNC(assigned_dev->host_devfn));
> + dev_info(&pdev->dev, "kvm deassign device\n");
>
> return 0;
> }
> --
> 1.8.1.2
--
Gleb.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-03 8:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 10:23 [PATCH 1/1] virt/kvm/iommu.c: Add leading zeros to device's BDF notation in debug messages Andre Richter
2013-10-02 10:35 ` Gleb Natapov
2013-10-02 15:41 ` Alex Williamson
2013-10-02 19:08 ` Andre Richter
2013-10-02 19:58 ` Alex Williamson
2013-10-03 8:48 ` Gleb Natapov
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).