[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/8] IOMMU: log appropriate SBDF


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 12 Apr 2022 12:39:54 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+V0mm3AtA+oYQawZcP0/2IPXDmXLlxlbVEw+qDbVSrE=; b=EV/loya8QfAPPLH1mNjKp03lu60SfzxT1w0QM94OHbfL45iMr+zAq1C/k12Cv66DvhwIk3iU71xhY0qBtwd5f7CyKM+lU/oV/TxK6arkBXdyLP448kgs6c8abWlQ8MqXwONk19LStRWdU1xfG+w0B7DLtYzUvWCopWzcYwRPT0ZvJ+H6o3Qcr2y2nihJjDt/Y3pUalz/NQ5s3nNOBdDh6SVQXTr2FIm0Et+2Kb4rdp8DQ93qU+ksp0gVF+T9YoyDUa10uoye8QbhWInSZGXeunWgRU1kL1RSlOQnQjrZv0WLdJYwYeKsuS0HFe9qf/svAX6VqSXjr4+Zi6tKbz6tyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kl+Onlq5loTM8HP5P6wqX3MHTr+jDt6qssWCbtjQ+4NZeyXlFcMLAYDuoaAsUp7esXnTf4sFsExK7hhlOuMaPQVhgceQnlwgFPaRcdSh8uE4SPSb/TViQ4rAObfQ+o/OC4dhuT4d5bgjr2HxZCHF4SfNp0Rfg1NWfXhSdMCWhR+IENUYRtPO82RUy3sbw2GwPe6kifyeD45JsgM1NPEXKaUaGMIzUJIiLjzVd2MQKTKqPdmLeQiwnQGBPDliOH9H3jt0aR38sDUukt5BQm9LiV4hFoe1gKdbyVRmGWBkaiYnmZWJbInyTNw2HUQT+wBuYL8+5AZvuye7v9KBaQ0+Ww==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Tue, 12 Apr 2022 10:40:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.04.2022 12:05, Roger Pau Monné wrote:
> On Mon, Apr 11, 2022 at 11:38:28AM +0200, Jan Beulich wrote:
>> To handle phantom devices, several functions are passed separate "devfn"
>> arguments besides a PCI device. In such cases we want to log the phantom
>> device's coordinates instead of the main one's. (Note that not all of
>> the instances being changed are fallout from the referenced commit.)
>>
>> Fixes: 1ee1441835f4 ("print: introduce a format specifier for pci_sbdf_t")
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks.

> I'm unsure it matters much to have the logs from failures to find an
> IOMMU using pdev->sbdf or devfn, as the parent device should have been
> added before attempting to add any phantom functions, and hence would
> have already failed to find an IOMMU.

That's the expectation, unless something unexpected is going on. Hence
better have precise information in the log.

>> --- a/xen/drivers/passthrough/amd/iommu_cmd.c
>> +++ b/xen/drivers/passthrough/amd/iommu_cmd.c
>> @@ -291,7 +291,8 @@ void amd_iommu_flush_iotlb(u8 devfn, con
>>  
>>      if ( !iommu )
>>      {
>> -        AMD_IOMMU_WARN("can't find IOMMU for %pp\n", &pdev->sbdf);
>> +        AMD_IOMMU_WARN("can't find IOMMU for %pp\n",
>> +                       &PCI_SBDF3(pdev->seg, pdev->bus, devfn));
> 
> Hm, the call to find_iommu_for_device() is explicitly using
> pdev->devfn, so while the iommu of the phantom function is tied to
> it's parent, it's unclear to me that logging the SBDF of the phantom
> function will make this clearer for a user reading the logs.

The phantom function may not be possible to find an IOMMU for, so
using the base device for the lookup is unavoidable. For the message
here and ...

>> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
>> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
>> @@ -461,7 +461,7 @@ static int cf_check reassign_device(
>>      if ( !iommu )
>>      {
>>          AMD_IOMMU_WARN("failed to find IOMMU: %pp cannot be assigned to 
>> %pd\n",
>> -                       &pdev->sbdf, target);
>> +                       &PCI_SBDF3(pdev->seg, pdev->bus, devfn), target);
> 
> IIRC we would first reassign the parent, and then the phantom
> functions, so we would always hit this error first with devfn ==
> pdev->sbdf.bdf.

... here what I said further up applies.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.