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

RE: [PATCH 17/17] IOMMU/x86: drop pointless NULL checks


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Thu, 16 Sep 2021 07:29:05 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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; bh=Vid34ud0rFRa4Wkk82svfoB2ymr9OfvkJrroyZKvVtc=; b=TzL+xHTVRSBQ0Me6P9+OloVS33Qpa9FfCSv4Ny7HCa2QbsLcVlX4Q6kcqS1OdafzjQDvwf8yNpageA+MerODGtajMoZO+S+gt/JKyww0ObiFd4FcKMFNq468wu8U8x/6j0vTU5ao5SgFKu/6YhY6zfpvTNz5ZsTfaNq0oXeoEFci+fY9dondNTF31rYxh8r+rNhg7sIl2WQH/g5vgzPvUamSGgIQ6xGNDOh/hOIDXRJ7Ko25a/e+0Qt/MxpQvFxANYM+/P3i8PxLVZy/5j82kQxNHmg6VspX1SI9TddQdysTxpeO/YDmGEiGiC8cs7kOtxTxYXpaoiq0r5KOvJlKHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IQB1uwW1sMv4/gxwoZ7VgTtSNv0/ExVwDFxrGt4u4a7O/e4C7GAjs5hNm4s5S27KKv2ixDzeCF2RKyQAc/eFnUJS1iYJbWTmq+/3ytql91MonPeo2azw5PmSrkzckRQld084soxWGZTpF0qrB8xKYmzEXnJMV0Y+j8lmefldglwt5EzhHMTPVNilFMqI9TWiD6+8AKFbND4+8wKnPkWUdY1JsWfj/rKbaQc3pKDWWjoatp/m6xtydYWE0xFCH77o4gfPMjkmrWZPf/1ttR/Anz53tdWhDKm0xxDIomIsJ/6v92KQ07QsscOS9rBcXdzOlt6bPgS49snUxIFfs3+JHA==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=intel.com;
  • Cc: "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Thu, 16 Sep 2021 07:30:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXmPQ6RAwx6Qn8tEyqmw4lz+vBDqumZRwQ
  • Thread-topic: [PATCH 17/17] IOMMU/x86: drop pointless NULL checks

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Tuesday, August 24, 2021 10:28 PM
> 
> map_domain_page() et al never fail; no need to check their return values
> against NULL, and no need to carry dead printk()s.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> 
> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> @@ -530,12 +530,6 @@ static void amd_dump_page_table_level(st
>          return;
> 
>      table_vaddr = __map_domain_page(pg);
> -    if ( table_vaddr == NULL )
> -    {
> -        printk("AMD IOMMU failed to map domain page %"PRIpaddr"\n",
> -                page_to_maddr(pg));
> -        return;
> -    }
> 
>      for ( index = 0; index < PTE_PER_TABLE_SIZE; index++ )
>      {
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2800,12 +2800,6 @@ static void vtd_dump_page_table_level(pa
>          return;
> 
>      pt_vaddr = map_vtd_domain_page(pt_maddr);
> -    if ( pt_vaddr == NULL )
> -    {
> -        printk(VTDPREFIX " failed to map domain page %"PRIpaddr"\n",
> -               pt_maddr);
> -        return;
> -    }
> 
>      next_level = level - 1;
>      for ( i = 0; i < PTE_NUM; i++ )
> --- a/xen/drivers/passthrough/vtd/utils.c
> +++ b/xen/drivers/passthrough/vtd/utils.c
> @@ -106,11 +106,6 @@ void print_vtd_entries(struct vtd_iommu
>      }
> 
>      root_entry = (struct root_entry *)map_vtd_domain_page(iommu-
> >root_maddr);
> -    if ( root_entry == NULL )
> -    {
> -        printk("    root_entry == NULL\n");
> -        return;
> -    }
> 
>      printk("    root_entry[%02x] = %"PRIx64"\n", bus, root_entry[bus].val);
>      if ( !root_present(root_entry[bus]) )
> @@ -123,11 +118,6 @@ void print_vtd_entries(struct vtd_iommu
>      val = root_entry[bus].val;
>      unmap_vtd_domain_page(root_entry);
>      ctxt_entry = map_vtd_domain_page(val);
> -    if ( ctxt_entry == NULL )
> -    {
> -        printk("    ctxt_entry == NULL\n");
> -        return;
> -    }
> 
>      val = ctxt_entry[devfn].lo;
>      printk("    context[%02x] = %"PRIx64"_%"PRIx64"\n",
> @@ -151,11 +141,6 @@ void print_vtd_entries(struct vtd_iommu
>      do
>      {
>          l = map_vtd_domain_page(val);
> -        if ( l == NULL )
> -        {
> -            printk("    l%u == NULL\n", level);
> -            break;
> -        }
>          l_index = get_level_index(gmfn, level);
>          pte.val = l[l_index];
>          unmap_vtd_domain_page(l);


 


Rackspace

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