lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Jul 2016 20:58:40 +0800
From:	kbuild test robot <lkp@...el.com>
To:	Serge Semin <fancer.lancer@...il.com>
Cc:	kbuild-all@...org, jdmason@...zu.us, dave.jiang@...el.com,
	Allen.Hubbe@....com, Xiangliang.Yu@....com,
	Sergey.Semin@...latforms.ru, linux-ntb@...glegroups.com,
	linux-kernel@...r.kernel.org, Serge Semin <fancer.lancer@...il.com>
Subject: Re: [PATCH 3/3] ntb: Test client drivers for asynchronous NTB devices

Hi,

[auto build test WARNING on ntb/ntb-next]
[cannot apply to v4.7 next-20160728]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Serge-Semin/ntb-Asynchronous-NTB-devices-support/20160727-082033
base:   https://github.com/jonmason/ntb ntb-next
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/swab.h:4:0,
                    from include/uapi/linux/byteorder/big_endian.h:12,
                    from include/linux/byteorder/big_endian.h:4,
                    from arch/sparc/include/uapi/asm/byteorder.h:4,
                    from arch/sparc/include/asm/bitops_64.h:15,
                    from arch/sparc/include/asm/bitops.h:4,
                    from include/linux/bitops.h:36,
                    from include/linux/kernel.h:10,
                    from drivers/ntb/test/ntb_mw_test.c:57:
   drivers/ntb/test/ntb_mw_test.c: In function 'mw_send_inmw_addrs':
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:116:32: note: in definition of macro '__swab32'
     (__builtin_constant_p((__u32)(x)) ? \
                                   ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:17:12: note: in definition of macro '___constant_swab32'
     (((__u32)(x) & (__u32)0x000000ffUL) << 24) |  \
               ^
   include/uapi/linux/byteorder/big_endian.h:32:43: note: in expansion of macro '__swab32'
    #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
                                              ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:18:12: note: in definition of macro '___constant_swab32'
     (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |  \
               ^
   include/uapi/linux/byteorder/big_endian.h:32:43: note: in expansion of macro '__swab32'
    #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
                                              ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:19:12: note: in definition of macro '___constant_swab32'
     (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |  \
               ^
   include/uapi/linux/byteorder/big_endian.h:32:43: note: in expansion of macro '__swab32'
    #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
                                              ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:20:12: note: in definition of macro '___constant_swab32'
     (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
               ^
   include/uapi/linux/byteorder/big_endian.h:32:43: note: in expansion of macro '__swab32'
    #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
                                              ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
>> drivers/ntb/test/ntb_mw_test.c:353:49: warning: right shift count >= width of type [-Wshift-count-overflow]
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                                                    ^
   include/uapi/linux/swab.h:118:12: note: in definition of macro '__swab32'
     __fswab32(x))
               ^
   include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__cpu_to_le32'
    #define cpu_to_le32 __cpu_to_le32
                        ^
>> drivers/ntb/test/ntb_mw_test.c:353:20: note: in expansion of macro 'to_sh32'
      msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
                       ^
   drivers/ntb/test/ntb_mw_test.c: In function 'mw_set_outmw_addr':
>> drivers/ntb/test/ntb_mw_test.c:407:61: warning: left shift count >= width of type [-Wshift-count-overflow]
     outmw->dma_addr |= ((dma_addr_t)from_sh32(msg->payload[1]) << 32);
                                                                ^
>> drivers/ntb/test/ntb_mw_test.c:413:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       "within %u bytes", (void *)outmw->dma_addr,
                          ^
   drivers/ntb/test/ntb_mw_test.c:189:29: note: in definition of macro 'dev_err_mw'
     dev_err(&ctx->ntb->dev, ## args)
                                ^
   drivers/ntb/test/ntb_mw_test.c:422:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       "outbound memory window %d", (void *)outmw->dma_addr,
                                    ^
   drivers/ntb/test/ntb_mw_test.c:189:29: note: in definition of macro 'dev_err_mw'
     dev_err(&ctx->ntb->dev, ## args)
                                ^
   In file included from include/linux/printk.h:289:0,
                    from include/linux/kernel.h:13,
                    from drivers/ntb/test/ntb_mw_test.c:57:
   drivers/ntb/test/ntb_mw_test.c:431:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      "address 0x%p", mwindx, (void *)outmw->dma_addr);
                              ^
   include/linux/dynamic_debug.h:87:9: note: in definition of macro 'dynamic_dev_dbg'
          ##__VA_ARGS__);  \
            ^
>> drivers/ntb/test/ntb_mw_test.c:195:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(&ctx->ntb->dev, ## args)
     ^
>> drivers/ntb/test/ntb_mw_test.c:430:2: note: in expansion of macro 'dev_dbg_mw'
     dev_dbg_mw(ctx, "Outbound memory window %d is initialized with "
     ^
   drivers/ntb/test/ntb_mw_test.c: In function 'mw_dbgfs_outmw_cfg_read':
   drivers/ntb/test/ntb_mw_test.c:766:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      "DMA address\t\t- 0x%p\n", (void *)wrap->dma_addr);
                                 ^
   drivers/ntb/test/ntb_mw_test.c: In function 'mw_dbgfs_inmw_cfg_read':
   drivers/ntb/test/ntb_mw_test.c:915:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      "DMA address\t\t- 0x%p\n", (void *)wrap->dma_addr);
                                 ^
   drivers/ntb/test/ntb_mw_test.c: In function 'mw_create_inmws':
   drivers/ntb/test/ntb_mw_test.c:1197:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
        "aligned with %lu", (void *)inmw->dma_addr, mwindx,
                            ^
   drivers/ntb/test/ntb_mw_test.c:189:29: note: in definition of macro 'dev_err_mw'
     dev_err(&ctx->ntb->dev, ## args)
                                ^

vim +353 drivers/ntb/test/ntb_mw_test.c

   189		dev_err(&ctx->ntb->dev, ## args)
   190	#define dev_warn_mw(ctx, args...) \
   191		dev_warn(&ctx->ntb->dev, ## args)
   192	#define dev_info_mw(ctx, args...) \
   193		dev_info(&ctx->ntb->dev, ## args)
   194	#define dev_dbg_mw(ctx, args...) \
 > 195		dev_dbg(&ctx->ntb->dev, ## args)
   196	
   197	/*
   198	 * Some common constant used in the driver for better readability:
   199	 * @ON: Enable something
   200	 * @OFF: Disable something
   201	 * @SUCCESS: Success of a function execution
   202	 * @MIN_MW_CNT:	Minimum memory windows count
   203	 * @MAX_MW_CNT: Maximum memory windows count
   204	 */
   205	#define ON ((u32)0x1)
   206	#define OFF ((u32)0x0)
   207	#define SUCCESS 0
   208	#define MIN_MW_CNT ((unsigned char)1)
   209	#define MAX_MW_CNT ((unsigned char)255)
   210	
   211	/*
   212	 * Shared data converter to support the different CPU architectures
   213	 */
   214	#define to_sh32(data) \
   215		cpu_to_le32((data))
   216	#define from_sh32(data) \
   217		le32_to_cpu((data))
   218	
   219	/*
   220	 * Module parameters:
   221	 * @inmw_cnt:	Number of inbound memory windows [1; 255]
   222	 * @outmw_cnt:	Number of outbound memory windows [1; 255]
   223	 * If the specified value exceeds the maximum possible valiue, then it is
   224	 * initialized with maximum one
   225	 */
   226	static unsigned char inmws_cnt = MAX_MW_CNT;
   227	module_param(inmws_cnt, byte, 0000);
   228	MODULE_PARM_DESC(inmws_cnt,
   229		"Inbound memory windows count. Those are the memory windows, which are "
   230		"locally allocated. Their address is sent to the remote host."
   231		" - Parameter can be set within [1; 255], where 255 means maximum possible"
   232		"   number of windows");
   233	
   234	/*===========================================================================
   235	 *                               Helper methods
   236	 *===========================================================================*/
   237	
   238	/*
   239	 * Alter the passed driver paremeters
   240	 */
   241	static void mw_alter_params(struct mw_ctx *ctx)
   242	{
   243		unsigned char inmws_cnt_bak = ctx->inmws_cnt;
   244	
   245		/* Clamp the inbound memory windows parameter */
   246		ctx->inmws_cnt = clamp(inmws_cnt,
   247			MIN_MW_CNT, (unsigned char)ctx->inmws_cnt);
   248		if (inmws_cnt_bak != ctx->inmws_cnt) {
   249			dev_warn_mw(ctx,
   250				"Inbound memory windows count is altered from "
   251				"%hhu to %hhu", inmws_cnt_bak, ctx->inmws_cnt);
   252		}
   253	
   254		dev_dbg_mw(ctx, "Memory windows test driver parameter is verified");
   255	}
   256	
   257	/*
   258	 * Memory block IO write method
   259	 */
   260	static void iomem_write(void __iomem *dst, const void *src, size_t cnt)
   261	{
   262		while (cnt--) {
   263			iowrite8(*(u8 *)src, dst);
   264			dst++;
   265			src++;
   266		}
   267	}
   268	
   269	/*
   270	 * Memory block IO read method
   271	 */
   272	static void iomem_read(void __iomem *src, void *dst, size_t cnt)
   273	{
   274		while (cnt--) {
   275			*(u8 *)dst = ioread8(src);
   276			dst++;
   277			src++;
   278		}
   279	}
   280	
   281	/*===========================================================================
   282	 *                          Message command handlers
   283	 *===========================================================================*/
   284	
   285	/*
   286	 * Send MW_GETADDRS command method
   287	 */
   288	static void mw_send_getaddrs_cmd(struct mw_ctx *ctx)
   289	{
   290		struct ntb_msg msg;
   291		int sts;
   292	
   293		/* Clear the message structure */
   294		memset(&msg, 0, sizeof(msg));
   295	
   296		/* Set the message type only */
   297		msg.type = to_sh32(MW_GETADDRS);
   298	
   299		/* Send the message */
   300		sts = ntb_msg_post(ctx->ntb, &msg);
   301		if (SUCCESS != sts) {
   302			dev_err_mw(ctx, "Failed to send message to get outbound window "
   303				"addresses");
   304		}
   305	}
   306	
   307	/*
   308	 * Send MW_FREEADDRS command method
   309	 */
   310	static void mw_send_freeaddrs_cmd(struct mw_ctx *ctx)
   311	{
   312		struct ntb_msg msg;
   313		int sts;
   314	
   315		/* Clear the message structure */
   316		memset(&msg, 0, sizeof(msg));
   317	
   318		/* Set the message type only */
   319		msg.type = to_sh32(MW_FREEADDRS);
   320	
   321		/* Send the message */
   322		sts = ntb_msg_post(ctx->ntb, &msg);
   323		if (SUCCESS != sts) {
   324			dev_err_mw(ctx, "Failed to send a message to disable the peer "
   325				"outbound windows");
   326		}
   327	}
   328	
   329	/*
   330	 * Callback method for response on the command MW_GETADDRS
   331	 */
   332	static void mw_send_inmw_addrs(struct mw_ctx *ctx)
   333	{
   334		struct ntb_msg msg;
   335		struct inmw_wrap *inmw;
   336		int mwindx, sts;
   337	
   338		/* Clear the message structure */
   339		memset(&msg, 0, sizeof(msg));
   340	
   341		/* Walk through all the inbound memory windows and send the
   342		 * corresponding DMA address of the window */
   343		for (mwindx = 0; mwindx < ctx->inmws_cnt; mwindx++) {
   344			inmw = &ctx->inmws[mwindx];
   345			/* Set the type and the memory window index */
   346			msg.type = to_sh32(MW_DMAADDR | ((u32)mwindx << 16));
   347	
   348			/* First set the size of the memory window */
   349			msg.payload[0] = to_sh32(inmw->size);
   350	
   351			/* Set the Upper part of the memory window address */
   352	#ifdef CONFIG_64BIT
 > 353			msg.payload[1] = to_sh32((u32)(inmw->dma_addr >> 32));
   354	#else
   355			/* WARNING! NTB entpoints must either have the same architecture
   356			 * (x32 or x64) or use lower 4Gb for memory windows */
   357			msg.payload[1] = 0;
   358	#endif /* !CONFIG_64BIT */
   359			/* Set the Lower part of the memory window address */
   360			msg.payload[2] = to_sh32((u32)(inmw->dma_addr));
   361	
   362			/* Send the message */
   363			sts = ntb_msg_post(ctx->ntb, &msg);
   364			if (SUCCESS != sts) {
   365				dev_err_mw(ctx,
   366					"Failed to send a message with window %d "
   367					"address", mwindx);
   368			}
   369		}
   370	}
   371	
   372	/*
   373	 * Method to set the corresponding memory window and enable it
   374	 */
   375	static void mw_set_outmw_addr(struct mw_ctx *ctx, const struct ntb_msg *msg)
   376	{
   377		struct outmw_wrap *outmw;
   378		int mwindx, sts;
   379	
   380		/* Read the memory windows index (it's the part of the message type) */
   381		mwindx = from_sh32(msg->type) >> 16;
   382		if (ctx->outmws_cnt <= mwindx) {
   383			dev_err_mw(ctx,
   384				"Retrieved invalid outbound memory window index %d",
   385				mwindx);
   386			return;
   387		}
   388		outmw = &ctx->outmws[mwindx];
   389	
   390		/* Read the memory window size and check whether it has proper size and
   391		 * alignment */
   392		outmw->size = from_sh32(msg->payload[0]);
   393		if (!IS_ALIGNED(outmw->size, outmw->size_align) ||
   394		    outmw->size_max < outmw->size) {
   395			dev_err_mw(ctx,
   396				"Retrieved invalid memory window %d size %u "
   397				"(max: %u, align: %u)", mwindx, (unsigned int)outmw->size,
   398				(unsigned int)outmw->size_max,
   399				(unsigned int)outmw->size_align);
   400			return;
   401		}
   402	
   403		/* Read the DMA address, where the second DWORD is the upper part and
   404		 * the third DWORD - lower */
   405		outmw->dma_addr = from_sh32(msg->payload[2]);
   406	#ifdef CONFIG_64BIT
 > 407		outmw->dma_addr |= ((dma_addr_t)from_sh32(msg->payload[1]) << 32);
   408	#endif /* CONFIG_64BIT */
   409		/* Check whether the retrieved address is properly aligned */
   410		if (!IS_ALIGNED(outmw->dma_addr, outmw->addr_align)) {
   411			dev_err_mw(ctx,
   412				"Outbound memory window address %p is not aligned "
 > 413				"within %u bytes", (void *)outmw->dma_addr,
   414				(unsigned int)outmw->addr_align);
   415			return;
   416		}
   417	
   418		/* Set the translation address of the outbound memory window */
   419		sts = ntb_mw_set_trans(ctx->ntb, mwindx, outmw->dma_addr, outmw->size);
   420		if (SUCCESS != sts) {
   421			dev_err_mw(ctx, "Failed to set the translated address %p of "
   422				"outbound memory window %d", (void *)outmw->dma_addr,
   423				mwindx);
   424			return;
   425		}
   426	
   427		/* Enable the memory window */
   428		outmw->enabled = true;
   429	
 > 430		dev_dbg_mw(ctx, "Outbound memory window %d is initialized with "
 > 431			"address 0x%p", mwindx, (void *)outmw->dma_addr);
   432	}
   433	
   434	/*

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/octet-stream" (46476 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ