public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails
@ 2012-10-09  0:36 Shuah Khan
  2012-10-10 16:51 ` Marcelo Tosatti
  2012-10-10 18:45 ` Marcelo Tosatti
  0 siblings, 2 replies; 4+ messages in thread
From: Shuah Khan @ 2012-10-09  0:36 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm, LKML, shuahkhan

Change existing kernel error message to include return value from
iommu_attach_device() when it fails. This will help debug device
assignment failures more effectively.

Signed-off-by: Shuah Khan <shuah.khan@hp.com>
---
 virt/kvm/iommu.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index 037cb67..18e1e30 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -168,11 +168,7 @@ int kvm_assign_device(struct kvm *kvm,
 
 	r = iommu_attach_device(domain, &pdev->dev);
 	if (r) {
-		printk(KERN_ERR "assign device %x:%x:%x.%x failed",
-			pci_domain_nr(pdev->bus),
-			pdev->bus->number,
-			PCI_SLOT(pdev->devfn),
-			PCI_FUNC(pdev->devfn));
+		dev_err(&pdev->dev, "kvm assign device failed ret %d", r);
 		return r;
 	}
 
-- 
1.7.9.5




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

* Re: [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails
  2012-10-09  0:36 [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails Shuah Khan
@ 2012-10-10 16:51 ` Marcelo Tosatti
  2012-10-10 18:20   ` Shuah Khan
  2012-10-10 18:45 ` Marcelo Tosatti
  1 sibling, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2012-10-10 16:51 UTC (permalink / raw)
  To: Shuah Khan; +Cc: avi, kvm, LKML, shuahkhan

On Mon, Oct 08, 2012 at 06:36:11PM -0600, Shuah Khan wrote:
> Change existing kernel error message to include return value from
> iommu_attach_device() when it fails. This will help debug device
> assignment failures more effectively.
> 
> Signed-off-by: Shuah Khan <shuah.khan@hp.com>
> ---
>  virt/kvm/iommu.c |    6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index 037cb67..18e1e30 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
> @@ -168,11 +168,7 @@ int kvm_assign_device(struct kvm *kvm,
>  
>  	r = iommu_attach_device(domain, &pdev->dev);
>  	if (r) {
> -		printk(KERN_ERR "assign device %x:%x:%x.%x failed",
> -			pci_domain_nr(pdev->bus),
> -			pdev->bus->number,
> -			PCI_SLOT(pdev->devfn),
> -			PCI_FUNC(pdev->devfn));
> +		dev_err(&pdev->dev, "kvm assign device failed ret %d", r);
>  		return r;
>  	}

Why removal of domain,bus,slot,func from the message?


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

* Re: [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails
  2012-10-10 16:51 ` Marcelo Tosatti
@ 2012-10-10 18:20   ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2012-10-10 18:20 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Shuah Khan, avi, kvm, LKML

On Wed, Oct 10, 2012 at 10:51 AM, Marcelo Tosatti <mtosatti@redhat.com> wrote:
> On Mon, Oct 08, 2012 at 06:36:11PM -0600, Shuah Khan wrote:
>> Change existing kernel error message to include return value from
>> iommu_attach_device() when it fails. This will help debug device
>> assignment failures more effectively.
>>
>> Signed-off-by: Shuah Khan <shuah.khan@hp.com>
>> ---
>>  virt/kvm/iommu.c |    6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
>> index 037cb67..18e1e30 100644
>> --- a/virt/kvm/iommu.c
>> +++ b/virt/kvm/iommu.c
>> @@ -168,11 +168,7 @@ int kvm_assign_device(struct kvm *kvm,
>>
>>       r = iommu_attach_device(domain, &pdev->dev);
>>       if (r) {
>> -             printk(KERN_ERR "assign device %x:%x:%x.%x failed",
>> -                     pci_domain_nr(pdev->bus),
>> -                     pdev->bus->number,
>> -                     PCI_SLOT(pdev->devfn),
>> -                     PCI_FUNC(pdev->devfn));
>> +             dev_err(&pdev->dev, "kvm assign device failed ret %d", r);
>>               return r;
>>       }
>
> Why removal of domain,bus,slot,func from the message?
>

dev_err() includes that information like this:

pci 0000:00:1d.0: assign device failed ret 0

Without the removal of domain,bus,slot,func from the message:

It will look like:

pci 0000:00:1d.0: assign device 0:0:1d.0 failed ret 0

Initially I left it in there and after testing, realized it is
duplicate information and decided to remove it.

-- Shuah

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

* Re: [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails
  2012-10-09  0:36 [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails Shuah Khan
  2012-10-10 16:51 ` Marcelo Tosatti
@ 2012-10-10 18:45 ` Marcelo Tosatti
  1 sibling, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2012-10-10 18:45 UTC (permalink / raw)
  To: Shuah Khan; +Cc: avi, kvm, LKML, shuahkhan

On Mon, Oct 08, 2012 at 06:36:11PM -0600, Shuah Khan wrote:
> Change existing kernel error message to include return value from
> iommu_attach_device() when it fails. This will help debug device
> assignment failures more effectively.
> 
> Signed-off-by: Shuah Khan <shuah.khan@hp.com>

Applied, thanks.


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

end of thread, other threads:[~2012-10-10 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09  0:36 [PATCH] virt/kvm: change kvm_assign_device() to print return value when iommu_attach_device() fails Shuah Khan
2012-10-10 16:51 ` Marcelo Tosatti
2012-10-10 18:20   ` Shuah Khan
2012-10-10 18:45 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox