linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Beau Belgrave <beaub@linux.microsoft.com>,
	rostedt@goodmis.org, mhiramat@kernel.org
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	beaub@linux.microsoft.com
Subject: Re: [PATCH v5 09/12] user_events: Optimize writing events by only copying data once
Date: Sat, 27 Nov 2021 23:09:30 +0800	[thread overview]
Message-ID: <202111272346.r2ZhQ5KM-lkp@intel.com> (raw)
In-Reply-To: <20211116005047.1808-10-beaub@linux.microsoft.com>

Hi Beau,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 67d4f6e3bf5dddced226fbf19704cdbbb0c98847]

url:    https://github.com/0day-ci/linux/commits/Beau-Belgrave/user_events-Enable-user-processes-to-create-and-write-to-trace-events/20211116-090533
base:   67d4f6e3bf5dddced226fbf19704cdbbb0c98847
config: hexagon-randconfig-r031-20211116 (https://download.01.org/0day-ci/archive/20211127/202111272346.r2ZhQ5KM-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project fbe72e41b99dc7994daac300d208a955be3e4a0a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/5d08d02e133130c59d164c17756a0aa0abb5418c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Beau-Belgrave/user_events-Enable-user-processes-to-create-and-write-to-trace-events/20211116-090533
        git checkout 5d08d02e133130c59d164c17756a0aa0abb5418c
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpio/ kernel/trace/

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 >>):

>> kernel/trace/trace_events_user.c:563:22: warning: comparison of distinct pointer types ('typeof (i->count) *' (aka 'unsigned int *') and 'typeof ((1UL << 16)) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types]
                   size_t copy_size = min(i->count, MAX_BPF_COPY_SIZE);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.


vim +563 kernel/trace/trace_events_user.c

   537	
   538	#ifdef CONFIG_PERF_EVENTS
   539	static void user_event_bpf(struct user_event *user, struct iov_iter *i)
   540	{
   541		struct user_bpf_context context;
   542		struct user_bpf_iter bpf_i;
   543		char fast_data[MAX_STACK_BPF_DATA];
   544		void *temp = NULL;
   545	
   546		if ((user->flags & FLAG_BPF_ITER) && iter_is_iovec(i)) {
   547			/* Raw iterator */
   548			context.data_type = USER_BPF_DATA_ITER;
   549			context.data_len = i->count;
   550			context.iter = &bpf_i;
   551	
   552			bpf_i.iov_offset = i->iov_offset;
   553			bpf_i.iov = i->iov;
   554			bpf_i.nr_segs = i->nr_segs;
   555		} else if (i->nr_segs == 1 && iter_is_iovec(i)) {
   556			/* Single buffer from user */
   557			context.data_type = USER_BPF_DATA_USER;
   558			context.data_len = i->count;
   559			context.udata = i->iov->iov_base + i->iov_offset;
   560		} else {
   561			/* Multi buffer from user */
   562			struct iov_iter copy = *i;
 > 563			size_t copy_size = min(i->count, MAX_BPF_COPY_SIZE);
   564	
   565			context.data_type = USER_BPF_DATA_KERNEL;
   566			context.kdata = fast_data;
   567	
   568			if (unlikely(copy_size > sizeof(fast_data))) {
   569				temp = kmalloc(copy_size, GFP_NOWAIT);
   570	
   571				if (temp)
   572					context.kdata = temp;
   573				else
   574					copy_size = sizeof(fast_data);
   575			}
   576	
   577			context.data_len = copy_nofault(context.kdata,
   578							copy_size, &copy);
   579		}
   580	
   581		trace_call_bpf(&user->call, &context);
   582	
   583		kfree(temp);
   584	}
   585	

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

  reply	other threads:[~2021-11-27 15:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16  0:50 [PATCH v5 00/12] user_events: Enable user processes to create and write to trace events Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 01/12] user_events: Add UABI header for user access to user_events Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 02/12] user_events: Add minimal support for trace_event into ftrace Beau Belgrave
2021-11-18  2:50   ` Steven Rostedt
2021-11-18 20:01     ` Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 03/12] user_events: Add print_fmt generation support for basic types Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 04/12] user_events: Handle matching arguments from dyn_events Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 05/12] user_events: Add basic perf and eBPF support Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 06/12] user_events: Add self-test for ftrace integration Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 07/12] user_events: Add self-test for dynamic_events integration Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 08/12] user_events: Add self-test for perf_event integration Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 09/12] user_events: Optimize writing events by only copying data once Beau Belgrave
2021-11-27 15:09   ` kernel test robot [this message]
2021-11-16  0:50 ` [PATCH v5 10/12] user_events: Add documentation file Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 11/12] user_events: Add sample code for typical usage Beau Belgrave
2021-11-16  0:50 ` [PATCH v5 12/12] user_events: Validate user payloads for size and null termination Beau Belgrave
2021-11-16 21:11   ` Beau Belgrave
2021-11-18  1:52     ` Steven Rostedt
2021-11-18 19:45       ` Beau Belgrave

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=202111272346.r2ZhQ5KM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=beaub@linux.microsoft.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.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).