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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202305242020.VlsOXEMn-lkp@intel.com>
Date:   Wed, 24 May 2023 20:48:04 +0800
From:   kernel test robot <lkp@...el.com>
To:     Daniel Bristot de Oliveira <bristot@...nel.org>,
        linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
        Steven Rostedt <rostedt@...dmis.org>
Cc:     oe-kbuild-all@...ts.linux.dev, Juri Lelli <juri.lelli@...hat.com>,
        William White <chwhite@...hat.com>,
        Daniel Bristot de Oliveira <bristot@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Jonathan Corbet <corbet@....net>
Subject: Re: [PATCH V2 3/3] tracing/timerlat: Add user-space interface

Hi Daniel,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.4-rc3 next-20230524]
[cannot apply to rostedt-trace/for-next rostedt-trace/for-next-urgent]
[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/Daniel-Bristot-de-Oliveira/tracing-osnoise-Switch-from-PF_NO_SETAFFINITY-to-migrate_disable/20230524-012512
base:   linus/master
patch link:    https://lore.kernel.org/r/a7b2c215c763e95a56fa1258743332b570c81c9d.1684860626.git.bristot%40kernel.org
patch subject: [PATCH V2 3/3] tracing/timerlat: Add user-space interface
config: i386-randconfig-i014-20230523
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/89216b54eaf490480bc1929f5780f95a688a91bb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Daniel-Bristot-de-Oliveira/tracing-osnoise-Switch-from-PF_NO_SETAFFINITY-to-migrate_disable/20230524-012512
        git checkout 89216b54eaf490480bc1929f5780f95a688a91bb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash kernel/trace/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305242020.VlsOXEMn-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   kernel/trace/trace_osnoise.c: In function 'timerlat_fd_open':
>> kernel/trace/trace_osnoise.c:2364:16: error: implicit declaration of function 'this_cpu_tmr_var'; did you mean 'this_cpu_osn_var'? [-Werror=implicit-function-declaration]
    2364 |         tlat = this_cpu_tmr_var();
         |                ^~~~~~~~~~~~~~~~
         |                this_cpu_osn_var
>> kernel/trace/trace_osnoise.c:2364:14: warning: assignment to 'struct timerlat_variables *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    2364 |         tlat = this_cpu_tmr_var();
         |              ^
>> kernel/trace/trace_osnoise.c:2365:13: error: invalid use of undefined type 'struct timerlat_variables'
    2365 |         tlat->count = 0;
         |             ^~
   kernel/trace/trace_osnoise.c: In function 'timerlat_fd_read':
>> kernel/trace/trace_osnoise.c:2387:32: error: storage size of 's' isn't known
    2387 |         struct timerlat_sample s;
         |                                ^
   kernel/trace/trace_osnoise.c:2393:14: warning: assignment to 'struct timerlat_variables *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    2393 |         tlat = this_cpu_tmr_var();
         |              ^
   kernel/trace/trace_osnoise.c:2401:25: error: invalid use of undefined type 'struct timerlat_variables'
    2401 |                 if (tlat->uthread_migrate) {
         |                         ^~
   In file included from include/asm-generic/percpu.h:7,
                    from arch/x86/include/asm/percpu.h:390,
                    from arch/x86/include/asm/current.h:10,
                    from include/linux/sched.h:12,
                    from include/linux/kthread.h:6,
                    from kernel/trace/trace_osnoise.c:19:
>> kernel/trace/trace_osnoise.c:2406:30: error: 'per_cpu_timerlat_var' undeclared (first use in this function)
    2406 |                 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                              ^~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:219:54: note: in definition of macro '__verify_pcpu_ptr'
     219 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
         |                                                      ^~~
   kernel/trace/trace_osnoise.c:2406:17: note: in expansion of macro 'per_cpu_ptr'
    2406 |                 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                 ^~~~~~~~~~~
   kernel/trace/trace_osnoise.c:2406:30: note: each undeclared identifier is reported only once for each function it appears in
    2406 |                 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                              ^~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:219:54: note: in definition of macro '__verify_pcpu_ptr'
     219 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
         |                                                      ^~~
   kernel/trace/trace_osnoise.c:2406:17: note: in expansion of macro 'per_cpu_ptr'
    2406 |                 per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                 ^~~~~~~~~~~
   kernel/trace/trace_osnoise.c:2424:60: error: invalid use of undefined type 'struct timerlat_variables'
    2424 |                 now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer));
         |                                                            ^~
   kernel/trace/trace_osnoise.c:2425:34: error: invalid use of undefined type 'struct timerlat_variables'
    2425 |                 diff = now - tlat->abs_period;
         |                                  ^~
   kernel/trace/trace_osnoise.c:2433:32: error: invalid use of undefined type 'struct timerlat_variables'
    2433 |                 s.seqnum = tlat->count;
         |                                ^~
>> kernel/trace/trace_osnoise.c:2437:17: error: implicit declaration of function 'trace_timerlat_sample' [-Werror=implicit-function-declaration]
    2437 |                 trace_timerlat_sample(&s);
         |                 ^~~~~~~~~~~~~~~~~~~~~
   kernel/trace/trace_osnoise.c:2441:21: error: invalid use of undefined type 'struct timerlat_variables'
    2441 |                 tlat->tracing_thread = false;
         |                     ^~
   kernel/trace/trace_osnoise.c:2446:21: error: invalid use of undefined type 'struct timerlat_variables'
    2446 |                 tlat->tracing_thread = false;
         |                     ^~
   kernel/trace/trace_osnoise.c:2447:21: error: invalid use of undefined type 'struct timerlat_variables'
    2447 |                 tlat->kthread = current;
         |                     ^~
   kernel/trace/trace_osnoise.c:2449:35: error: invalid use of undefined type 'struct timerlat_variables'
    2449 |                 hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
         |                                   ^~
   kernel/trace/trace_osnoise.c:2450:21: error: invalid use of undefined type 'struct timerlat_variables'
    2450 |                 tlat->timer.function = timerlat_irq;
         |                     ^~
>> kernel/trace/trace_osnoise.c:2450:40: error: 'timerlat_irq' undeclared (first use in this function); did you mean 'timerlat_main'?
    2450 |                 tlat->timer.function = timerlat_irq;
         |                                        ^~~~~~~~~~~~
         |                                        timerlat_main
   kernel/trace/trace_osnoise.c:2453:21: error: invalid use of undefined type 'struct timerlat_variables'
    2453 |                 tlat->abs_period = hrtimer_cb_get_time(&tlat->timer);
         |                     ^~
   kernel/trace/trace_osnoise.c:2453:61: error: invalid use of undefined type 'struct timerlat_variables'
    2453 |                 tlat->abs_period = hrtimer_cb_get_time(&tlat->timer);
         |                                                             ^~
>> kernel/trace/trace_osnoise.c:2459:9: error: implicit declaration of function 'wait_next_period' [-Werror=implicit-function-declaration]
    2459 |         wait_next_period(tlat);
         |         ^~~~~~~~~~~~~~~~
   kernel/trace/trace_osnoise.c:2462:52: error: invalid use of undefined type 'struct timerlat_variables'
    2462 |         now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer));
         |                                                    ^~
   kernel/trace/trace_osnoise.c:2463:26: error: invalid use of undefined type 'struct timerlat_variables'
    2463 |         diff = now - tlat->abs_period;
         |                          ^~
   kernel/trace/trace_osnoise.c:2471:24: error: invalid use of undefined type 'struct timerlat_variables'
    2471 |         s.seqnum = tlat->count;
         |                        ^~
>> kernel/trace/trace_osnoise.c:2479:25: error: implicit declaration of function 'timerlat_dump_stack'; did you mean 'trace_dump_stack'? [-Werror=implicit-function-declaration]
    2479 |                         timerlat_dump_stack(time_to_us(diff));
         |                         ^~~~~~~~~~~~~~~~~~~
         |                         trace_dump_stack
>> kernel/trace/trace_osnoise.c:2387:32: warning: unused variable 's' [-Wunused-variable]
    2387 |         struct timerlat_sample s;
         |                                ^
   In file included from include/asm-generic/percpu.h:7,
                    from arch/x86/include/asm/percpu.h:390,
                    from arch/x86/include/asm/current.h:10,
                    from include/linux/sched.h:12,
                    from include/linux/kthread.h:6,
                    from kernel/trace/trace_osnoise.c:19:
   kernel/trace/trace_osnoise.c: In function 'timerlat_fd_release':
   kernel/trace/trace_osnoise.c:2500:33: error: 'per_cpu_timerlat_var' undeclared (first use in this function)
    2500 |         tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);
         |                                 ^~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:219:54: note: in definition of macro '__verify_pcpu_ptr'
     219 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
         |                                                      ^~~
   kernel/trace/trace_osnoise.c:2500:20: note: in expansion of macro 'per_cpu_ptr'
    2500 |         tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);
         |                    ^~~~~~~~~~~
   kernel/trace/trace_osnoise.c:2502:33: error: invalid use of undefined type 'struct timerlat_variables'
    2502 |         hrtimer_cancel(&tlat_var->timer);
         |                                 ^~
   In file included from include/linux/string.h:254,
                    from arch/x86/include/asm/page_32.h:18,
                    from arch/x86/include/asm/page.h:14,
                    from arch/x86/include/asm/thread_info.h:12,
                    from include/linux/thread_info.h:60,
                    from arch/x86/include/asm/preempt.h:9,
                    from include/linux/preempt.h:78,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/kthread.h:6,
                    from kernel/trace/trace_osnoise.c:19:
>> kernel/trace/trace_osnoise.c:2503:35: error: invalid application of 'sizeof' to incomplete type 'struct timerlat_variables'
    2503 |         memset(tlat_var, 0, sizeof(*tlat_var));
         |                                   ^
   include/linux/fortify-string.h:451:42: note: in definition of macro '__fortify_memset_chk'
     451 |         size_t __fortify_size = (size_t)(size);                         \
         |                                          ^~~~
   kernel/trace/trace_osnoise.c:2503:9: note: in expansion of macro 'memset'
    2503 |         memset(tlat_var, 0, sizeof(*tlat_var));
         |         ^~~~~~
   In file included from include/asm-generic/percpu.h:7,
                    from arch/x86/include/asm/percpu.h:390,
                    from arch/x86/include/asm/current.h:10,
                    from include/linux/sched.h:12,
                    from include/linux/kthread.h:6,
                    from kernel/trace/trace_osnoise.c:19:
   kernel/trace/trace_osnoise.c: In function 'check_timerlat_user_migration':
   kernel/trace/trace_osnoise.c:2529:38: error: 'per_cpu_timerlat_var' undeclared (first use in this function)
    2529 |                         per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                                      ^~~~~~~~~~~~~~~~~~~~
   include/linux/percpu-defs.h:219:54: note: in definition of macro '__verify_pcpu_ptr'
     219 |         const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL;    \
         |                                                      ^~~
   kernel/trace/trace_osnoise.c:2529:25: note: in expansion of macro 'per_cpu_ptr'
    2529 |                         per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
         |                         ^~~~~~~~~~~
   At top level:
>> kernel/trace/trace_osnoise.c:2618:37: warning: 'timerlat_fd_fops' defined but not used [-Wunused-const-variable=]
    2618 | static const struct file_operations timerlat_fd_fops = {
         |                                     ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +2364 kernel/trace/trace_osnoise.c

  2305	
  2306	static int timerlat_fd_open(struct inode *inode, struct file *file)
  2307	{
  2308		struct osnoise_variables *osn_var;
  2309		struct timerlat_variables *tlat;
  2310		long cpu = (long) inode->i_cdev;
  2311	
  2312		mutex_lock(&interface_lock);
  2313	
  2314		/*
  2315		 * This file is accessible only if timerlat is enabled, and
  2316		 * NO_OSNOISE_WORKLOAD is set.
  2317		 */
  2318		if (!timerlat_enabled() || test_bit(OSN_WORKLOAD, &osnoise_options)) {
  2319			mutex_unlock(&interface_lock);
  2320			return -EINVAL;
  2321		}
  2322	
  2323		migrate_disable();
  2324	
  2325		osn_var = this_cpu_osn_var();
  2326	
  2327		/*
  2328		 * The osn_var->pid holds the single access to this file.
  2329		 */
  2330		if (osn_var->pid) {
  2331			mutex_unlock(&interface_lock);
  2332			migrate_enable();
  2333			return -EBUSY;
  2334		}
  2335	
  2336		/*
  2337		 * timerlat tracer is a per-cpu tracer. Check if the user-space too
  2338		 * is pinned to a single CPU. The tracer laters monitor if the task
  2339		 * migrates and then disables tracer if it does. However, it is
  2340		 * worth doing this basic acceptance test to avoid obviusly wrong
  2341		 * setup.
  2342		 */
  2343		if (current->nr_cpus_allowed > 1 ||  cpu != smp_processor_id()) {
  2344			mutex_unlock(&interface_lock);
  2345			migrate_enable();
  2346			return -EPERM;
  2347		}
  2348	
  2349		/*
  2350		 * From now on, it is good to go.
  2351		 */
  2352		file->private_data = inode->i_cdev;
  2353	
  2354		get_task_struct(current);
  2355	
  2356		osn_var->kthread = current;
  2357		osn_var->pid = current->pid;
  2358	
  2359		/*
  2360		 * Setup is done.
  2361		 */
  2362		mutex_unlock(&interface_lock);
  2363	
> 2364		tlat = this_cpu_tmr_var();
> 2365		tlat->count = 0;
  2366	
  2367		migrate_enable();
  2368		return 0;
  2369	};
  2370	
  2371	/*
  2372	 * timerlat_fd_read - Read function for "timerlat_fd" file
  2373	 * @file: The active open file structure
  2374	 * @ubuf: The userspace provided buffer to read value into
  2375	 * @cnt: The maximum number of bytes to read
  2376	 * @ppos: The current "file" position
  2377	 *
  2378	 * Prints 1 on timerlat, the number of interferences on osnoise, -1 on error.
  2379	 */
  2380	static ssize_t
  2381	timerlat_fd_read(struct file *file, char __user *ubuf, size_t count,
  2382			  loff_t *ppos)
  2383	{
  2384		long cpu = (long) file->private_data;
  2385		struct osnoise_variables *osn_var;
  2386		struct timerlat_variables *tlat;
> 2387		struct timerlat_sample s;
  2388		s64 diff;
  2389		u64 now;
  2390	
  2391		migrate_disable();
  2392	
  2393		tlat = this_cpu_tmr_var();
  2394	
  2395		/*
  2396		 * While in user-space, the thread is migratable. There is nothing
  2397		 * we can do about it.
  2398		 * So, if the thread is running on another CPU, stop the machinery.
  2399		 */
  2400		if (cpu == smp_processor_id()) {
  2401			if (tlat->uthread_migrate) {
  2402				migrate_enable();
  2403				return -EINVAL;
  2404			}
  2405		} else {
> 2406			per_cpu_ptr(&per_cpu_timerlat_var, cpu)->uthread_migrate = 1;
  2407			osnoise_taint("timerlat user thread migrate\n");
  2408			osnoise_stop_tracing();
  2409			migrate_enable();
  2410			return -EINVAL;
  2411		}
  2412	
  2413		osn_var = this_cpu_osn_var();
  2414	
  2415		/*
  2416		 * The timerlat in user-space runs in a different order:
  2417		 * the read() starts from the execution of the previous occurrence,
  2418		 * sleeping for the next occurrence.
  2419		 *
  2420		 * So, skip if we are entering on read() before the first wakeup
  2421		 * from timerlat IRQ:
  2422		 */
  2423		if (likely(osn_var->sampling)) {
  2424			now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer));
  2425			diff = now - tlat->abs_period;
  2426	
  2427			/*
  2428			 * it was not a timer firing, but some other signal?
  2429			 */
  2430			if (diff < 0)
  2431				goto out;
  2432	
  2433			s.seqnum = tlat->count;
  2434			s.timer_latency = diff;
  2435			s.context = THREAD_URET;
  2436	
> 2437			trace_timerlat_sample(&s);
  2438	
  2439			notify_new_max_latency(diff);
  2440	
  2441			tlat->tracing_thread = false;
  2442			if (osnoise_data.stop_tracing_total)
  2443				if (time_to_us(diff) >= osnoise_data.stop_tracing_total)
  2444					osnoise_stop_tracing();
  2445		} else {
  2446			tlat->tracing_thread = false;
  2447			tlat->kthread = current;
  2448	
  2449			hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
> 2450			tlat->timer.function = timerlat_irq;
  2451	
  2452			/* Annotate now to drift new period */
  2453			tlat->abs_period = hrtimer_cb_get_time(&tlat->timer);
  2454	
  2455			osn_var->sampling = 1;
  2456		}
  2457	
  2458		/* wait for the next period */
> 2459		wait_next_period(tlat);
  2460	
  2461		/* This is the wakeup from this cycle */
  2462		now = ktime_to_ns(hrtimer_cb_get_time(&tlat->timer));
  2463		diff = now - tlat->abs_period;
  2464	
  2465		/*
  2466		 * it was not a timer firing, but some other signal?
  2467		 */
  2468		if (diff < 0)
  2469			goto out;
  2470	
  2471		s.seqnum = tlat->count;
  2472		s.timer_latency = diff;
  2473		s.context = THREAD_CONTEXT;
  2474	
  2475		trace_timerlat_sample(&s);
  2476	
  2477		if (osnoise_data.stop_tracing_total) {
  2478			if (time_to_us(diff) >= osnoise_data.stop_tracing_total) {
> 2479				timerlat_dump_stack(time_to_us(diff));
  2480				notify_new_max_latency(diff);
  2481				osnoise_stop_tracing();
  2482			}
  2483		}
  2484	
  2485	out:
  2486		migrate_enable();
  2487		return 0;
  2488	}
  2489	
  2490	static int timerlat_fd_release(struct inode *inode, struct file *file)
  2491	{
  2492		struct osnoise_variables *osn_var;
  2493		struct timerlat_variables *tlat_var;
  2494		long cpu = (long) file->private_data;
  2495	
  2496		migrate_disable();
  2497		mutex_lock(&interface_lock);
  2498	
  2499		osn_var = per_cpu_ptr(&per_cpu_osnoise_var, cpu);
  2500		tlat_var = per_cpu_ptr(&per_cpu_timerlat_var, cpu);
  2501	
  2502		hrtimer_cancel(&tlat_var->timer);
> 2503		memset(tlat_var, 0, sizeof(*tlat_var));
  2504	
  2505		osn_var->sampling = 0;
  2506		osn_var->pid = 0;
  2507	
  2508		/*
  2509		 * We are leaving, not being stopped... see stop_kthread();
  2510		 */
  2511		if (osn_var->kthread) {
  2512			put_task_struct(osn_var->kthread);
  2513			osn_var->kthread = NULL;
  2514		}
  2515	
  2516		mutex_unlock(&interface_lock);
  2517		migrate_enable();
  2518		return 0;
  2519	}
  2520	

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

View attachment "config" of type "text/plain" (149684 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ