Re: [PATCH 6/6] dma-mapping: benchmark: add IOVA support

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

 



Hi Luis,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.15-rc7 next-20250516]
[cannot apply to vkoul-dmaengine/next shuah-kselftest/next shuah-kselftest/fixes sysctl/sysctl-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Luis-Chamberlain/fake-dma-add-fake-dma-engine-driver/20250521-064035
base:   linus/master
patch link:    https://lore.kernel.org/r/20250520223913.3407136-7-mcgrof%40kernel.org
patch subject: [PATCH 6/6] dma-mapping: benchmark: add IOVA support
config: hexagon-randconfig-002-20250521 (https://download.01.org/0day-ci/archive/20250521/202505211909.CzQtqtu8-lkp@xxxxxxxxx/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250521/202505211909.CzQtqtu8-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505211909.CzQtqtu8-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   kernel/dma/map_benchmark.c:60:25: error: variable has incomplete type 'struct dma_iova_state'
      60 |                 struct dma_iova_state iova_state;
         |                                       ^
   kernel/dma/map_benchmark.c:60:10: note: forward declaration of 'struct dma_iova_state'
      60 |                 struct dma_iova_state iova_state;
         |                        ^
   kernel/dma/map_benchmark.c:76:8: error: call to undeclared function 'dma_iova_try_alloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      76 |                 if (!dma_iova_try_alloc(map->dev, &iova_state, phys, size)) {
         |                      ^
   kernel/dma/map_benchmark.c:88:9: error: call to undeclared function 'dma_iova_link'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      88 |                 ret = dma_iova_link(map->dev, &iova_state, phys, 0, size, dir, 0);
         |                       ^
   kernel/dma/map_benchmark.c:94:4: error: call to undeclared function 'dma_iova_free'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      94 |                         dma_iova_free(map->dev, &iova_state);
         |                         ^
   kernel/dma/map_benchmark.c:101:9: error: call to undeclared function 'dma_iova_sync'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     101 |                 ret = dma_iova_sync(map->dev, &iova_state, 0, size);
         |                       ^
   kernel/dma/map_benchmark.c:107:4: error: call to undeclared function 'dma_iova_unlink'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     107 |                         dma_iova_unlink(map->dev, &iova_state, 0, size, dir, 0);
         |                         ^
   kernel/dma/map_benchmark.c:108:4: error: call to undeclared function 'dma_iova_free'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     108 |                         dma_iova_free(map->dev, &iova_state);
         |                         ^
   kernel/dma/map_benchmark.c:118:3: error: call to undeclared function 'dma_iova_destroy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     118 |                 dma_iova_destroy(map->dev, &iova_state, size, dir, 0);
         |                 ^
>> kernel/dma/map_benchmark.c:340:23: warning: variable 'iova_threads' set but not used [-Wunused-but-set-variable]
     340 |         int regular_threads, iova_threads;
         |                              ^
   1 warning and 8 errors generated.


vim +/iova_threads +340 kernel/dma/map_benchmark.c

   334	
   335	static int do_streaming_iova_benchmark(struct map_benchmark_data *map)
   336	{
   337		struct task_struct **tsk;
   338		int threads = map->bparam.threads;
   339		int node = map->bparam.node;
 > 340		int regular_threads, iova_threads;
   341		u64 loops, iova_loops;
   342		int ret = 0;
   343		int i;
   344	
   345		tsk = kmalloc_array(threads * 2, sizeof(*tsk), GFP_KERNEL);
   346		if (!tsk)
   347			return -ENOMEM;
   348	
   349		get_device(map->dev);
   350	
   351		/* Split threads between regular and IOVA testing */
   352		regular_threads = threads / 2;
   353		iova_threads = threads - regular_threads;
   354	
   355		/* Create streaming DMA threads */
   356		for (i = 0; i < regular_threads; i++) {
   357			tsk[i] = kthread_create_on_node(benchmark_thread_streaming, map,
   358					node, "dma-streaming-benchmark/%d", i);
   359			if (IS_ERR(tsk[i])) {
   360				pr_err("create dma_map thread failed\n");
   361				ret = PTR_ERR(tsk[i]);
   362				while (--i >= 0)
   363					kthread_stop(tsk[i]);
   364				goto out;
   365			}
   366	
   367			if (node != NUMA_NO_NODE)
   368				kthread_bind_mask(tsk[i], cpumask_of_node(node));
   369		}
   370	
   371		/* Create IOVA DMA threads */
   372		for (i = regular_threads; i < threads; i++) {
   373			tsk[i] = kthread_create_on_node(benchmark_thread_iova, map,
   374					node, "dma-iova-benchmark/%d", i - regular_threads);
   375			if (IS_ERR(tsk[i])) {
   376				pr_err("create dma_iova thread failed\n");
   377				ret = PTR_ERR(tsk[i]);
   378				while (--i >= 0)
   379					kthread_stop(tsk[i]);
   380				goto out;
   381			}
   382	
   383			if (node != NUMA_NO_NODE)
   384				kthread_bind_mask(tsk[i], cpumask_of_node(node));
   385		}
   386	
   387		/* Clear previous benchmark values */
   388		atomic64_set(&map->sum_map_100ns, 0);
   389		atomic64_set(&map->sum_unmap_100ns, 0);
   390		atomic64_set(&map->sum_sq_map, 0);
   391		atomic64_set(&map->sum_sq_unmap, 0);
   392		atomic64_set(&map->loops, 0);
   393	
   394		atomic64_set(&map->sum_iova_alloc_100ns, 0);
   395		atomic64_set(&map->sum_iova_link_100ns, 0);
   396		atomic64_set(&map->sum_iova_sync_100ns, 0);
   397		atomic64_set(&map->sum_iova_destroy_100ns, 0);
   398		atomic64_set(&map->sum_sq_iova_alloc, 0);
   399		atomic64_set(&map->sum_sq_iova_link, 0);
   400		atomic64_set(&map->sum_sq_iova_sync, 0);
   401		atomic64_set(&map->sum_sq_iova_destroy, 0);
   402		atomic64_set(&map->iova_loops, 0);
   403	
   404		/* Start all threads */
   405		for (i = 0; i < threads; i++) {
   406			get_task_struct(tsk[i]);
   407			wake_up_process(tsk[i]);
   408		}
   409	
   410		msleep_interruptible(map->bparam.seconds * 1000);
   411	
   412		/* Stop all threads */
   413		for (i = 0; i < threads; i++) {
   414			int kthread_ret = kthread_stop_put(tsk[i]);
   415			if (kthread_ret)
   416				ret = kthread_ret;
   417		}
   418	
   419		if (ret)
   420			goto out;
   421	
   422		/* Calculate streaming DMA statistics */
   423		loops = atomic64_read(&map->loops);
   424		if (loops > 0) {
   425			u64 map_variance, unmap_variance;
   426			u64 sum_map = atomic64_read(&map->sum_map_100ns);
   427			u64 sum_unmap = atomic64_read(&map->sum_unmap_100ns);
   428			u64 sum_sq_map = atomic64_read(&map->sum_sq_map);
   429			u64 sum_sq_unmap = atomic64_read(&map->sum_sq_unmap);
   430	
   431			map->bparam.avg_map_100ns = div64_u64(sum_map, loops);
   432			map->bparam.avg_unmap_100ns = div64_u64(sum_unmap, loops);
   433	
   434			map_variance = div64_u64(sum_sq_map, loops) -
   435					map->bparam.avg_map_100ns * map->bparam.avg_map_100ns;
   436			unmap_variance = div64_u64(sum_sq_unmap, loops) -
   437					map->bparam.avg_unmap_100ns * map->bparam.avg_unmap_100ns;
   438			map->bparam.map_stddev = int_sqrt64(map_variance);
   439			map->bparam.unmap_stddev = int_sqrt64(unmap_variance);
   440		}
   441	
   442		/* Calculate IOVA statistics */
   443		iova_loops = atomic64_read(&map->iova_loops);
   444		if (iova_loops > 0) {
   445			u64 alloc_variance, link_variance, sync_variance, destroy_variance;
   446			u64 sum_alloc = atomic64_read(&map->sum_iova_alloc_100ns);
   447			u64 sum_link = atomic64_read(&map->sum_iova_link_100ns);
   448			u64 sum_sync = atomic64_read(&map->sum_iova_sync_100ns);
   449			u64 sum_destroy = atomic64_read(&map->sum_iova_destroy_100ns);
   450	
   451			map->bparam.avg_iova_alloc_100ns = div64_u64(sum_alloc, iova_loops);
   452			map->bparam.avg_iova_link_100ns = div64_u64(sum_link, iova_loops);
   453			map->bparam.avg_iova_sync_100ns = div64_u64(sum_sync, iova_loops);
   454			map->bparam.avg_iova_destroy_100ns = div64_u64(sum_destroy, iova_loops);
   455	
   456			alloc_variance = div64_u64(atomic64_read(&map->sum_sq_iova_alloc), iova_loops) -
   457					map->bparam.avg_iova_alloc_100ns * map->bparam.avg_iova_alloc_100ns;
   458			link_variance = div64_u64(atomic64_read(&map->sum_sq_iova_link), iova_loops) -
   459					map->bparam.avg_iova_link_100ns * map->bparam.avg_iova_link_100ns;
   460			sync_variance = div64_u64(atomic64_read(&map->sum_sq_iova_sync), iova_loops) -
   461					map->bparam.avg_iova_sync_100ns * map->bparam.avg_iova_sync_100ns;
   462			destroy_variance = div64_u64(atomic64_read(&map->sum_sq_iova_destroy), iova_loops) -
   463					map->bparam.avg_iova_destroy_100ns * map->bparam.avg_iova_destroy_100ns;
   464	
   465			map->bparam.iova_alloc_stddev = int_sqrt64(alloc_variance);
   466			map->bparam.iova_link_stddev = int_sqrt64(link_variance);
   467			map->bparam.iova_sync_stddev = int_sqrt64(sync_variance);
   468			map->bparam.iova_destroy_stddev = int_sqrt64(destroy_variance);
   469		}
   470	
   471	out:
   472		put_device(map->dev);
   473		kfree(tsk);
   474		return ret;
   475	}
   476	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux