iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>,
	iommu@lists.linux-foundation.org,
	LKML <linux-kernel@vger.kernel.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	David Woodhouse <dwmw2@infradead.org>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	kbuild-all@lists.01.org, Raj Ashok <ashok.raj@intel.com>
Subject: Re: [PATCH v4 4/7] iommu/vt-d: Handle non-page aligned address
Date: Tue, 7 Jul 2020 21:32:40 +0800	[thread overview]
Message-ID: <202007072152.EVgFqx18%lkp@intel.com> (raw)
In-Reply-To: <1594080774-33413-5-git-send-email-jacob.jun.pan@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 10185 bytes --]

Hi Jacob,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on linux/master linus/master v5.8-rc4 next-20200707]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jacob-Pan/iommu-vt-d-Misc-tweaks-and-fixes-for-vSVA/20200707-081026
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-randconfig-m031-20200707 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/string.h:6,
                    from include/linux/uuid.h:12,
                    from include/linux/mod_devicetable.h:13,
                    from include/linux/pci.h:27,
                    from drivers/iommu/intel/dmar.c:19:
   drivers/iommu/intel/dmar.c: In function 'qi_flush_dev_iotlb_pasid':
   include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                            ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~
   include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                                        ^
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~
   include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                            ^
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~
   include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                                        ^
   include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                             ^~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~
   include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                            ^
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~
   include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
      26 |   __builtin_constant_p((l) > (h)), (l) > (h), 0)))
         |                                        ^
   include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
      69 |  (cond) ?     \
         |   ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
>> drivers/iommu/intel/dmar.c:1459:2: note: in expansion of macro 'if'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |  ^~
   include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
      25 |  (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
         |   ^~~~~~~~~~~~~~~~~
   include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
      45 |  (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
         |   ^~~~~~~~~~~~~~~~~~~
   drivers/iommu/intel/dmar.c:1459:13: note: in expansion of macro 'GENMASK_ULL'
    1459 |  if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
         |             ^~~~~~~~~~~

vim +/if +1459 drivers/iommu/intel/dmar.c

  1438	
  1439	/* PASID-based device IOTLB Invalidate */
  1440	void qi_flush_dev_iotlb_pasid(struct intel_iommu *iommu, u16 sid, u16 pfsid,
  1441				      u32 pasid,  u16 qdep, u64 addr, unsigned int size_order)
  1442	{
  1443		unsigned long mask = 1UL << (VTD_PAGE_SHIFT + size_order - 1);
  1444		struct qi_desc desc = {.qw1 = 0, .qw2 = 0, .qw3 = 0};
  1445	
  1446		desc.qw0 = QI_DEV_EIOTLB_PASID(pasid) | QI_DEV_EIOTLB_SID(sid) |
  1447			QI_DEV_EIOTLB_QDEP(qdep) | QI_DEIOTLB_TYPE |
  1448			QI_DEV_IOTLB_PFSID(pfsid);
  1449	
  1450		/*
  1451		 * If S bit is 0, we only flush a single page. If S bit is set,
  1452		 * The least significant zero bit indicates the invalidation address
  1453		 * range. VT-d spec 6.5.2.6.
  1454		 * e.g. address bit 12[0] indicates 8KB, 13[0] indicates 16KB.
  1455		 * size order = 0 is PAGE_SIZE 4KB
  1456		 * Max Invs Pending (MIP) is set to 0 for now until we have DIT in
  1457		 * ECAP.
  1458		 */
> 1459		if (addr & GENMASK_ULL(size_order + VTD_PAGE_SHIFT, 0))
  1460			pr_warn_ratelimited("Invalidate non-aligned address %llx, order %d\n", addr, size_order);
  1461	
  1462		/* Take page address */
  1463		desc.qw1 = QI_DEV_EIOTLB_ADDR(addr);
  1464	
  1465		if (size_order) {
  1466			/*
  1467			 * Existing 0s in address below size_order may be the least
  1468			 * significant bit, we must set them to 1s to avoid having
  1469			 * smaller size than desired.
  1470			 */
  1471			desc.qw1 |= GENMASK_ULL(size_order + VTD_PAGE_SHIFT,
  1472						VTD_PAGE_SHIFT);
  1473			/* Clear size_order bit to indicate size */
  1474			desc.qw1 &= ~mask;
  1475			/* Set the S bit to indicate flushing more than 1 page */
  1476			desc.qw1 |= QI_DEV_EIOTLB_SIZE;
  1477		}
  1478	
  1479		qi_submit_sync(iommu, &desc, 1, 0);
  1480	}
  1481	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32274 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-07-07 13:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  0:12 [PATCH v4 0/7] iommu/vt-d: Misc tweaks and fixes for vSVA Jacob Pan
2020-07-07  0:12 ` [PATCH v4 1/7] iommu/vt-d: Enforce PASID devTLB field mask Jacob Pan
2020-07-07  0:12 ` [PATCH v4 2/7] iommu/vt-d: Remove global page support in devTLB flush Jacob Pan
2020-07-07  0:12 ` [PATCH v4 3/7] iommu/vt-d: Fix PASID devTLB invalidation Jacob Pan
2020-07-16  7:52   ` Auger Eric
2020-07-07  0:12 ` [PATCH v4 4/7] iommu/vt-d: Handle non-page aligned address Jacob Pan
2020-07-07 13:32   ` kernel test robot [this message]
2020-07-09  1:10     ` [kbuild-all] " Li, Philip
2020-07-16  7:51   ` Auger Eric
2020-07-21 16:50   ` Jacob Pan
2020-07-22  1:01     ` Lu Baolu
2020-07-22 18:20       ` Jacob Pan
2020-07-07  0:12 ` [PATCH v4 5/7] iommu/vt-d: Fix devTLB flush for vSVA Jacob Pan
2020-07-07  0:12 ` [PATCH v4 6/7] iommu/vt-d: Warn on out-of-range invalidation address Jacob Pan
2020-07-16  8:40   ` Auger Eric
2020-07-07  0:12 ` [PATCH v4 7/7] iommu/vt-d: Disable multiple GPASID-dev bind Jacob Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202007072152.EVgFqx18%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).