From patchwork Mon Feb 26 18:49:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 206878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2285456dyb; Mon, 26 Feb 2024 11:22:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlInablvnngHJyQdefPb6ErhUeBNuxTpy/ONGMLslF/WaEWm8VTNkGcrFk0xYqEUn0OSOFbr6WgRyxyr7DQp227e2GlQ== X-Google-Smtp-Source: AGHT+IE3du6aiVJUDZoEnBey0HJahrFy7ZZEbwVdi1h+0GAtsHhbpnQWAygHu4iur/72hkynjJN4 X-Received: by 2002:a05:6a20:ce4d:b0:1a0:f616:32be with SMTP id id13-20020a056a20ce4d00b001a0f61632bemr113675pzb.10.1708975336032; Mon, 26 Feb 2024 11:22:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708975336; cv=pass; d=google.com; s=arc-20160816; b=PUEDBYThwvBIsrhRLPYoQrCEG0FQjLxhJNtZMlgV+XG6P2V7r1K0J5PrUxYYpXaDDy slCzhRm42sJ0DtBpkqXMncMiVoqXGjrM/Ytp7g3GwxVwgEV2FDnvicYgoQcgVDdHji9g sRrh0D3Niji7DsJi9s6U8F3JHqscps9vCRXQ0MvJhq8egOw87UP09rmHejjkSkKfybCY m4Xi6VGmaq3jlwHf/R9UGfJHnkCSiCXOelDVlm9qMwJ9KWEl0kVVMDLKPXxkuTVvAhYv hmPVw7RT+d57TNp3Zo0qDk3QXCSjoBtXBU/FOVbQXCP8fLIU4PKzqPzZHuSP1C4TkYrz eLjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=ukYCgLmWqaw/yTzAVlWZNsfQISY3EhxK/DpTnF7OHh8=; fh=MDvFsUN6PRuzLZU7LaMYkzXMxtePpK1+2F8PiX1OcTg=; b=XWDNn089oRmSuNfrbNf/kLxrnWSQq4SvNCsjPIQPnwfJJxIdwCwynkcvaQ1o/L99/a KDb5EgjdhT1U/sFs5u5PrmIysd6HiWlwqq+bKvll2fTPkNi0OQvo/6u9OyOjisDVTBT6 jxwg3wPBhFobIlB0hRUhfOu3cVmyLCbXOqiNWzyk6YEmeTWOvTdJ3kYdBIC6nr7BEyQ4 00/fwpcorOZ47zV2cpz8h0AsxKicaPKZkcJy2KXK2teRKdmdy9VpaMmVY6rSrddYz+b1 xQPhArIazZEBwwxD0gqdMn109S1hDqi5kCNzFzfXbCNQB0q0sklSh9NhdljU2sIBOZwW denw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82156-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p29-20020a635b1d000000b005d8bb422554si4108387pgb.195.2024.02.26.11.22.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 11:22:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82156-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 39B34B257EF for ; Mon, 26 Feb 2024 18:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BF40130E4F; Mon, 26 Feb 2024 18:47:54 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09B8E1292FF for ; Mon, 26 Feb 2024 18:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; cv=none; b=r8DbMD4ymHDAkD/tf/b0hPwWxfvRIcZv26GSjjSE7xEz6T3xugGqOT9lQvP/ChJaDyRTf9KaO5dF9tMZXRk029Wyz216smyfA35yLl4A4Ud3SHpkrxRvP7dN/jXhmCQdCGMI5Uo73bI348WA1w6Ycnn3a5AS0E/M2co/jkOVB3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; c=relaxed/simple; bh=IBgQ7YkMj+3tJKIboyqi6DmF4X89yamrjupGBGu5TUc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=YvYCCfDalhgdyk/E4OFZWcr+uDx5K7Q6v+Yc5t2BWpfba0GEY94mH33w9xA1rsdbm8ghMFwHe8uhjXdvvEXkJM7Q94eN58pJt6CGsv0M3tCqEhcw2XDBDY3bKAg2UmDQY/4WTuJwoIEw3ar4y4tbKyOHdSjlwhnaQs90PWUa/ao= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A376EC43390; Mon, 26 Feb 2024 18:47:50 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1reg2w-000000090ZS-40DS; Mon, 26 Feb 2024 13:49:50 -0500 Message-ID: <20240226184950.815545072@goodmis.org> User-Agent: quilt/0.67 Date: Mon, 26 Feb 2024 13:49:33 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , kernel test robot , Randy Dunlap Subject: [for-next][PATCH 1/5] ftrace: Fix most kernel-doc warnings References: <20240226184932.303400070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791990522209461389 X-GMAIL-MSGID: 1791990522209461389 From: Randy Dunlap Reduce the number of kernel-doc warnings from 52 down to 10, i.e., fix 42 kernel-doc warnings by (a) using the Returns: format for function return values or (b) using "@var:" instead of "@var -" for function parameter descriptions. Fix one return values list so that it is formatted correctly when rendered for output. Spell "non-zero" with a hyphen in several places. Link: https://lore.kernel.org/linux-trace-kernel/20240223054833.15471-1-rdunlap@infradead.org Cc: Mathieu Desnoyers Cc: Mark Rutland Link: https://lore.kernel.org/oe-kbuild-all/202312180518.X6fRyDSN-lkp@intel.com/ Reported-by: kernel test robot Acked-by: Masami Hiramatsu (Google) Signed-off-by: Randy Dunlap Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 90 ++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 83ba342aef31..da1710499698 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1160,7 +1160,7 @@ __ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) * Search a given @hash to see if a given instruction pointer (@ip) * exists in it. * - * Returns the entry that holds the @ip if found. NULL otherwise. + * Returns: the entry that holds the @ip if found. NULL otherwise. */ struct ftrace_func_entry * ftrace_lookup_ip(struct ftrace_hash *hash, unsigned long ip) @@ -1282,7 +1282,7 @@ static void free_ftrace_hash_rcu(struct ftrace_hash *hash) /** * ftrace_free_filter - remove all filters for an ftrace_ops - * @ops - the ops to remove the filters from + * @ops: the ops to remove the filters from */ void ftrace_free_filter(struct ftrace_ops *ops) { @@ -1587,7 +1587,7 @@ static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end) * @end: end of range to search (inclusive). @end points to the last byte * to check. * - * Returns rec->ip if the related ftrace location is a least partly within + * Returns: rec->ip if the related ftrace location is a least partly within * the given address range. That is, the first address of the instruction * that is either a NOP or call to the function tracer. It checks the ftrace * internal tables to determine if the address belongs or not. @@ -1607,9 +1607,10 @@ unsigned long ftrace_location_range(unsigned long start, unsigned long end) * ftrace_location - return the ftrace location * @ip: the instruction pointer to check * - * If @ip matches the ftrace location, return @ip. - * If @ip matches sym+0, return sym's ftrace location. - * Otherwise, return 0. + * Returns: + * * If @ip matches the ftrace location, return @ip. + * * If @ip matches sym+0, return sym's ftrace location. + * * Otherwise, return 0. */ unsigned long ftrace_location(unsigned long ip) { @@ -1639,7 +1640,7 @@ unsigned long ftrace_location(unsigned long ip) * @start: start of range to search * @end: end of range to search (inclusive). @end points to the last byte to check. * - * Returns 1 if @start and @end contains a ftrace location. + * Returns: 1 if @start and @end contains a ftrace location. * That is, the instruction that is either a NOP or call to * the function tracer. It checks the ftrace internal tables to * determine if the address belongs or not. @@ -2574,7 +2575,7 @@ static void call_direct_funcs(unsigned long ip, unsigned long pip, * wants to convert to a callback that saves all regs. If FTRACE_FL_REGS * is not set, then it wants to convert to the normal callback. * - * Returns the address of the trampoline to set to + * Returns: the address of the trampoline to set to */ unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec) { @@ -2615,7 +2616,7 @@ unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec) * a function that saves all the regs. Basically the '_EN' version * represents the current state of the function. * - * Returns the address of the trampoline that is currently being called + * Returns: the address of the trampoline that is currently being called */ unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec) { @@ -2719,7 +2720,7 @@ struct ftrace_rec_iter { /** * ftrace_rec_iter_start - start up iterating over traced functions * - * Returns an iterator handle that is used to iterate over all + * Returns: an iterator handle that is used to iterate over all * the records that represent address locations where functions * are traced. * @@ -2751,7 +2752,7 @@ struct ftrace_rec_iter *ftrace_rec_iter_start(void) * ftrace_rec_iter_next - get the next record to process. * @iter: The handle to the iterator. * - * Returns the next iterator after the given iterator @iter. + * Returns: the next iterator after the given iterator @iter. */ struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter) { @@ -2776,7 +2777,7 @@ struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter) * ftrace_rec_iter_record - get the record at the iterator location * @iter: The current iterator location * - * Returns the record that the current @iter is at. + * Returns: the record that the current @iter is at. */ struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter) { @@ -4010,6 +4011,8 @@ ftrace_avail_addrs_open(struct inode *inode, struct file *file) * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. * tracing_lseek() should be used as the lseek routine, and * release must call ftrace_regex_release(). + * + * Returns: 0 on success or a negative errno value on failure */ int ftrace_regex_open(struct ftrace_ops *ops, int flag, @@ -4626,7 +4629,7 @@ struct ftrace_func_mapper { /** * allocate_ftrace_func_mapper - allocate a new ftrace_func_mapper * - * Returns a ftrace_func_mapper descriptor that can be used to map ips to data. + * Returns: a ftrace_func_mapper descriptor that can be used to map ips to data. */ struct ftrace_func_mapper *allocate_ftrace_func_mapper(void) { @@ -4646,7 +4649,7 @@ struct ftrace_func_mapper *allocate_ftrace_func_mapper(void) * @mapper: The mapper that has the ip maps * @ip: the instruction pointer to find the data for * - * Returns the data mapped to @ip if found otherwise NULL. The return + * Returns: the data mapped to @ip if found otherwise NULL. The return * is actually the address of the mapper data pointer. The address is * returned for use cases where the data is no bigger than a long, and * the user can use the data pointer as its data instead of having to @@ -4672,7 +4675,7 @@ void **ftrace_func_mapper_find_ip(struct ftrace_func_mapper *mapper, * @ip: The instruction pointer address to map @data to * @data: The data to map to @ip * - * Returns 0 on success otherwise an error. + * Returns: 0 on success otherwise an error. */ int ftrace_func_mapper_add_ip(struct ftrace_func_mapper *mapper, unsigned long ip, void *data) @@ -4701,7 +4704,7 @@ int ftrace_func_mapper_add_ip(struct ftrace_func_mapper *mapper, * @mapper: The mapper that has the ip maps * @ip: The instruction pointer address to remove the data from * - * Returns the data if it is found, otherwise NULL. + * Returns: the data if it is found, otherwise NULL. * Note, if the data pointer is used as the data itself, (see * ftrace_func_mapper_find_ip(), then the return value may be meaningless, * if the data pointer was set to zero. @@ -5625,10 +5628,10 @@ EXPORT_SYMBOL_GPL(modify_ftrace_direct); /** * ftrace_set_filter_ip - set a function to filter on in ftrace by address - * @ops - the ops to set the filter with - * @ip - the address to add to or remove from the filter. - * @remove - non zero to remove the ip from the filter - * @reset - non zero to reset all filters before applying this filter. + * @ops: the ops to set the filter with + * @ip: the address to add to or remove from the filter. + * @remove: non zero to remove the ip from the filter + * @reset: non zero to reset all filters before applying this filter. * * Filters denote which functions should be enabled when tracing is enabled * If @ip is NULL, it fails to update filter. @@ -5647,11 +5650,11 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter_ip); /** * ftrace_set_filter_ips - set functions to filter on in ftrace by addresses - * @ops - the ops to set the filter with - * @ips - the array of addresses to add to or remove from the filter. - * @cnt - the number of addresses in @ips - * @remove - non zero to remove ips from the filter - * @reset - non zero to reset all filters before applying this filter. + * @ops: the ops to set the filter with + * @ips: the array of addresses to add to or remove from the filter. + * @cnt: the number of addresses in @ips + * @remove: non zero to remove ips from the filter + * @reset: non zero to reset all filters before applying this filter. * * Filters denote which functions should be enabled when tracing is enabled * If @ips array or any ip specified within is NULL , it fails to update filter. @@ -5670,7 +5673,7 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter_ips); /** * ftrace_ops_set_global_filter - setup ops to use global filters - * @ops - the ops which will use the global filters + * @ops: the ops which will use the global filters * * ftrace users who need global function trace filtering should call this. * It can set the global filter only if ops were not initialized before. @@ -5694,10 +5697,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, /** * ftrace_set_filter - set a function to filter on in ftrace - * @ops - the ops to set the filter with - * @buf - the string that holds the function filter text. - * @len - the length of the string. - * @reset - non zero to reset all filters before applying this filter. + * @ops: the ops to set the filter with + * @buf: the string that holds the function filter text. + * @len: the length of the string. + * @reset: non-zero to reset all filters before applying this filter. * * Filters denote which functions should be enabled when tracing is enabled. * If @buf is NULL and reset is set, all functions will be enabled for tracing. @@ -5716,10 +5719,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter); /** * ftrace_set_notrace - set a function to not trace in ftrace - * @ops - the ops to set the notrace filter with - * @buf - the string that holds the function notrace text. - * @len - the length of the string. - * @reset - non zero to reset all filters before applying this filter. + * @ops: the ops to set the notrace filter with + * @buf: the string that holds the function notrace text. + * @len: the length of the string. + * @reset: non-zero to reset all filters before applying this filter. * * Notrace Filters denote which functions should not be enabled when tracing * is enabled. If @buf is NULL and reset is set, all functions will be enabled @@ -5738,9 +5741,9 @@ int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, EXPORT_SYMBOL_GPL(ftrace_set_notrace); /** * ftrace_set_global_filter - set a function to filter on with global tracers - * @buf - the string that holds the function filter text. - * @len - the length of the string. - * @reset - non zero to reset all filters before applying this filter. + * @buf: the string that holds the function filter text. + * @len: the length of the string. + * @reset: non-zero to reset all filters before applying this filter. * * Filters denote which functions should be enabled when tracing is enabled. * If @buf is NULL and reset is set, all functions will be enabled for tracing. @@ -5753,9 +5756,9 @@ EXPORT_SYMBOL_GPL(ftrace_set_global_filter); /** * ftrace_set_global_notrace - set a function to not trace with global tracers - * @buf - the string that holds the function notrace text. - * @len - the length of the string. - * @reset - non zero to reset all filters before applying this filter. + * @buf: the string that holds the function notrace text. + * @len: the length of the string. + * @reset: non-zero to reset all filters before applying this filter. * * Notrace Filters denote which functions should not be enabled when tracing * is enabled. If @buf is NULL and reset is set, all functions will be enabled @@ -7443,7 +7446,7 @@ NOKPROBE_SYMBOL(ftrace_ops_assist_func); * have its own recursion protection, then it should call the * ftrace_ops_assist_func() instead. * - * Returns the function that the trampoline should call for @ops. + * Returns: the function that the trampoline should call for @ops. */ ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops) { @@ -7897,7 +7900,7 @@ void ftrace_kill(void) /** * ftrace_is_dead - Test if ftrace is dead or not. * - * Returns 1 if ftrace is "dead", zero otherwise. + * Returns: 1 if ftrace is "dead", zero otherwise. */ int ftrace_is_dead(void) { @@ -8142,8 +8145,7 @@ static int kallsyms_callback(void *data, const char *name, unsigned long addr) * @addrs array, which needs to be big enough to store at least @cnt * addresses. * - * This function returns 0 if all provided symbols are found, - * -ESRCH otherwise. + * Returns: 0 if all provided symbols are found, -ESRCH otherwise. */ int ftrace_lookup_symbols(const char **sorted_syms, size_t cnt, unsigned long *addrs) { From patchwork Mon Feb 26 18:49:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 206853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2268056dyb; Mon, 26 Feb 2024 10:48:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWIannEfOoBcsRxwC4HM6f5q5EMJTSjgPkTdK+wWWCIxP7HbfzATG0dGK7C1v/ReQ51N9r0ZtflKsFGDsZEoaVhj7zISg== X-Google-Smtp-Source: AGHT+IFbU1JFur9QK2W5q8ZWX+P5WhfMEtt4NxWP+761LA3p/VDKtMxDHPyYAbSD0i3ZnQdmxVsD X-Received: by 2002:a05:6512:1053:b0:512:bf09:624a with SMTP id c19-20020a056512105300b00512bf09624amr5363287lfb.66.1708973327710; Mon, 26 Feb 2024 10:48:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973327; cv=pass; d=google.com; s=arc-20160816; b=SW/jb9v5G9znUxrKDLotm5+pWfMVgwPUQodOqcACQB/2Ak5L/gkJ2rguwy15s9FGGR Rut39XryBW6MnInaXGQzNHrdU3R9oqNUPIWgnpBqe0ko2x3f2nS8Yl3V7SxOY9s9SLao u/9xKkkZuJYJtH7sP8bMMAAt8HlwL02FR7hnUwHDizKYrj3s4pamS1ZywW6UEGviLRHr NmOqHGqm7lBMF+jt9vgj6moOJd6+FQy+w7AMAb8BU2yedL7mSQLLG8ikJIZnN6v/HENR SsD1ese2TmcRHa/grrxnGAKxKuY2gQ4R4/2LW0obp1VKapCarmlP4WieFlkb1u55QGsj TbHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=Hzp0kBe6NOcOkwO2q9cYUCT941BNrt3/XdZsc3KZZxw=; fh=YJNbiTDh1bXPtSAuYY4pcZdHhYfKKcW8mPN0yeq1P+4=; b=PG73DDFQ1SGH2SiYN4/Wk7q/ADMGyleFOC1BrDUcgOotg7ZI1sy+/6pY9yQgtuQ2ai RaaC4lFN2Kf+VCzJA09cAwI08hvk32mmd+kL9+8fxDF434atSikALMQ2EefAOcd9QEQC 3A3zM8NuWotaLSNefxp4yjXUIA05K3c8LO+evfCHYlMalz7gRLpA1yVgmK/nfSSLZERy 7tRG9cnKNhY6hDOiF19nCS0K9S+pUWffE6+FRzTT0KkFONLNYlx0YhIGhP7pV5d59Fu2 7BJF5/9JbDEFeyPFA/SQnWzME1h4xLtBvkX93bvmDOYoJb595uP1Q44Rx9zcbiqrWhzA Z4Aw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82155-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82155-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l12-20020a170906230c00b00a3e40f8ea26si16032eja.18.2024.02.26.10.48.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:48:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82155-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82155-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82155-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5100E1F2A468 for ; Mon, 26 Feb 2024 18:48:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9E52130AF0; Mon, 26 Feb 2024 18:47:52 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09BD912B165 for ; Mon, 26 Feb 2024 18:47:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; cv=none; b=Zlz+hg74/zh1tLb0BEhTDIZS30uR7AUGNM0SfHtBfW6xqP657+G78wCO26gMFoPzF8H4oWljdZgWO2Uf3eNRHzcx9pOWjhATQbJytuaLw6BuLEilN2WghDPcJjUhBerrRbeu2sP95Kkx9FxgvLMQRPP50OwCDeBo2aa49+WkiRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; c=relaxed/simple; bh=FIsqY0GYMu8i4l2YcwaXi7PM31Nn7I2D2TKH/biGcbg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=QCegnIdXF4tevpx3I1+X35kcGwrShp+hGnuIXrTp4o7dPHbbESkY2ch/D7w+LAOTPFT/IOtNbS6zscOO2as0VCY2Gk6q0T/WM97bLdr37uIHvOJBn75/aIrpX1sk4Fjghik9l/f7+BR9cCEMvLWp0GrEf9f1ezOGEinIEka/jSc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B750FC43399; Mon, 26 Feb 2024 18:47:50 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1reg2x-000000090Zx-0UhY; Mon, 26 Feb 2024 13:49:51 -0500 Message-ID: <20240226184950.974920801@goodmis.org> User-Agent: quilt/0.67 Date: Mon, 26 Feb 2024 13:49:34 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Chuck Lever , Jeff Layton Subject: [for-next][PATCH 2/5] tracing: Remove __assign_str_len() References: <20240226184932.303400070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791988415883046013 X-GMAIL-MSGID: 1791988415883046013 From: "Steven Rostedt (Google)" Now that __assign_str() gets the length from the __string() (and __string_len()) macros, there's no reason to have a separate __assign_str_len() macro as __assign_str() can get the length of the string needed. Also remove __assign_rel_str() although it had no users anyway. Link: https://lore.kernel.org/linux-trace-kernel/20240223152206.0b650659@gandalf.local.home Cc: Chuck Lever Cc: Jeff Layton Signed-off-by: Steven Rostedt (Google) Acked-by: Chuck Lever --- fs/nfsd/trace.h | 8 +++--- include/trace/stages/stage6_event_callback.h | 28 ++++++++------------ samples/trace_events/trace-events-sample.h | 9 ++++--- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 2cd57033791f..98b14f30d772 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -102,7 +102,7 @@ TRACE_EVENT(nfsd_compound, TP_fast_assign( __entry->xid = be32_to_cpu(rqst->rq_xid); __entry->opcnt = opcnt; - __assign_str_len(tag, tag, taglen); + __assign_str(tag, tag); ), TP_printk("xid=0x%08x opcnt=%u tag=%s", __entry->xid, __entry->opcnt, __get_str(tag) @@ -483,7 +483,7 @@ TRACE_EVENT(nfsd_dirent, TP_fast_assign( __entry->fh_hash = fhp ? knfsd_fh_hash(&fhp->fh_handle) : 0; __entry->ino = ino; - __assign_str_len(name, name, namlen) + __assign_str(name, name); ), TP_printk("fh_hash=0x%08x ino=%llu name=%s", __entry->fh_hash, __entry->ino, __get_str(name) @@ -853,7 +853,7 @@ DECLARE_EVENT_CLASS(nfsd_clid_class, __entry->flavor = clp->cl_cred.cr_flavor; memcpy(__entry->verifier, (void *)&clp->cl_verifier, NFS4_VERIFIER_SIZE); - __assign_str_len(name, clp->cl_name.data, clp->cl_name.len); + __assign_str(name, clp->cl_name.data); ), TP_printk("addr=%pISpc name='%s' verifier=0x%s flavor=%s client=%08x:%08x", __entry->addr, __get_str(name), @@ -1800,7 +1800,7 @@ TRACE_EVENT(nfsd_ctl_time, TP_fast_assign( __entry->netns_ino = net->ns.inum; __entry->time = time; - __assign_str_len(name, name, namelen); + __assign_str(name, name); ), TP_printk("file=%s time=%d\n", __get_str(name), __entry->time diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h index 2bfd49713b42..0c0f50bcdc56 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -32,16 +32,13 @@ #undef __assign_str #define __assign_str(dst, src) \ - memcpy(__get_str(dst), __data_offsets.dst##_ptr_ ? : EVENT_NULL_STR, \ - __get_dynamic_array_len(dst)) - -#undef __assign_str_len -#define __assign_str_len(dst, src, len) \ do { \ - memcpy(__get_str(dst), \ - __data_offsets.dst##_ptr_ ? : EVENT_NULL_STR, len); \ - __get_str(dst)[len] = '\0'; \ - } while(0) + char *__str__ = __get_str(dst); \ + int __len__ = __get_dynamic_array_len(dst) - 1; \ + memcpy(__str__, __data_offsets.dst##_ptr_ ? : \ + EVENT_NULL_STR, __len__); \ + __str__[__len__] = '\0'; \ + } while (0) #undef __assign_vstr #define __assign_vstr(dst, fmt, va) \ @@ -94,15 +91,12 @@ #undef __assign_rel_str #define __assign_rel_str(dst, src) \ - memcpy(__get_rel_str(dst), __data_offsets.dst##_ptr_ ? : EVENT_NULL_STR, \ - __get_rel_dynamic_array_len(dst)) - -#undef __assign_rel_str_len -#define __assign_rel_str_len(dst, src, len) \ do { \ - memcpy(__get_rel_str(dst), \ - __data_offsets.dst##_ptr_ ? : EVENT_NULL_STR, len); \ - __get_rel_str(dst)[len] = '\0'; \ + char *__str__ = __get_rel_str(dst); \ + int __len__ = __get_rel_dynamic_array_len(dst) - 1; \ + memcpy(__str__, __data_offsets.dst##_ptr_ ? : \ + EVENT_NULL_STR, __len__); \ + __str__[__len__] = '\0'; \ } while (0) #undef __rel_bitmask diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 23f923ccd529..f2d2d56ce8e2 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h @@ -163,8 +163,7 @@ * __string(). * * __string_len: This is a helper to a __dynamic_array, but it understands - * that the array has characters in it, and with the combined - * use of __assign_str_len(), it will allocate 'len' + 1 bytes + * that the array has characters in it, it will allocate 'len' + 1 bytes * in the ring buffer and add a '\0' to the string. This is * useful if the string being saved has no terminating '\0' byte. * It requires that the length of the string is known as it acts @@ -174,9 +173,11 @@ * * __string_len(foo, bar, len) * - * To assign this string, use the helper macro __assign_str_len(). + * To assign this string, use the helper macro __assign_str(). + * The length is saved via the __string_len() and is retrieved in + * __assign_str(). * - * __assign_str_len(foo, bar, len); + * __assign_str(foo, bar); * * Then len + 1 is allocated to the ring buffer, and a nul terminating * byte is added. This is similar to: From patchwork Mon Feb 26 18:49:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 206852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2268050dyb; Mon, 26 Feb 2024 10:48:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU8oWdBkpB2xMBkTHmzHXUGnFl/jifU2cIoDRkvFC5BvdXDl6+DJOTq3DcCjKQbUR3jtgl601HR2mdeq3ye5lc0JRSclg== X-Google-Smtp-Source: AGHT+IHfoVaetleil9fRc8MGVDNWY/Cdo646cAhTeR9a0HLFeAo0Pixk2Ud0UL7wj62tkftHQrXO X-Received: by 2002:a17:903:2450:b0:1db:bbe0:9e9 with SMTP id l16-20020a170903245000b001dbbbe009e9mr11312283pls.58.1708973326961; Mon, 26 Feb 2024 10:48:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973326; cv=pass; d=google.com; s=arc-20160816; b=VfaPK9HbAwCuOt85jWNzeqdlFHj/Ay/gsdstDlXkyQz/axFGbBfBnxZz5UIuc9gNtK DsmACTFhvd4kFJjWLaL6cTEAEMpGb20ZaAjvKCTUZaH6BNmWcYGGtWGDHYetHunB7BmZ xLePJP19M0Ji9/G0PYzVCkwdFRxaZY29R5OkwaY4dFWd2dDPUIpZeqPYIexWRpJ0UP+P 65HBd3TQZKsCz5jWg0/U6cWIOcBdcig1ylGoXH4fe1lM4XWKvvdyrtp9zZ91SfKgon/G uzPU404Yi0jutUYl9/3ue67FZtxvKLzcsvuTBHflUL5sZqMMJbZbF3JAcxix4OsO/yuf Feew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=oZuh+E/K/c65xwgTz8MQuV1gOMp10ozar/xc4tuH5Zw=; fh=mTYg3JJ8i2GBNLFt8qb4bgYwOyk0kmrOzICLbi6qJ1c=; b=XBqGNF/DPkQ06ihKvZZ6SN7YXatxlNextb2Ci7WOc8oqP5XXT4yYf2qAtmR6uoabqj unEhiPrArM9hwpcDpuJBPPdmvKsIX2PPU0zlUWaTWPtISUr6f5bdeVtmB2CEAms5HIHz VMbKh93GOhxSZlT2pgHM1MRO2gXFTDWOckFaoWMWbluGOC4+bj7ca3sPsq0F+SM5uJwC HgW5CNp/LF3+HeABShYjIplcoOOz2AD+17RGJ/1U75lK8rpAS2nP4vvC54q9lQHPIR1j kaJjjR9dvimNGj3x8hJOz5pulQbBS8EvDBoc4iux63UfrcVN8K9Dqhoqnn89LM8+hMi/ tO3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82157-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82157-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j21-20020a170902c3d500b001dc76d25f0esi14360plj.650.2024.02.26.10.48.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:48:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82157-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82157-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82157-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A58D628EE9C for ; Mon, 26 Feb 2024 18:48:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F01DF130AF1; Mon, 26 Feb 2024 18:47:52 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51F5812F366 for ; Mon, 26 Feb 2024 18:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; cv=none; b=CntxigCjstfrleyTmRQ+4l0m6V7eMxvOTLXC8FqYElq15qK5oJ8iuwClY2FCO5Jb6ouxi/ZEl8OXNzdUY7CGIMflWIBOmBqdIGjaw5eFm038ZkSETSZqqCV6R3Oyg/rMU8AQqKpmBS1DQvsGPFji/haCTk/zgEdMoBfyCiWy8x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; c=relaxed/simple; bh=HhCGbYUvJpsjVhZrwqg9MzrWJrNfc26aXG/vEKAtQdY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=UgKO3uSo6fOVmK9NpkRbl0sl2jd8jCl8WPSDlLEJi3uao6Y2wnOdhniYtUg4x+NXQsMM+GkfFIqQmajCjx4sYMImSjdfXov5t700U+tEcAXXytBqD2RADHfxZc1efhK50IQQAZpSEkTsn7zOm2FDIe6+iAFwO+yvkHVwK3qVp+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB1F1C43394; Mon, 26 Feb 2024 18:47:50 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1reg2x-000000090aR-1AML; Mon, 26 Feb 2024 13:49:51 -0500 Message-ID: <20240226184951.137652037@goodmis.org> User-Agent: quilt/0.67 Date: Mon, 26 Feb 2024 13:49:35 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 3/5] tracing: Add __string_len() example References: <20240226184932.303400070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791988415232769133 X-GMAIL-MSGID: 1791988415232769133 From: "Steven Rostedt (Google)" There's no example code that uses __string_len(), and since the sample code is used for testing the event logic, add a use case. Link: https://lore.kernel.org/linux-trace-kernel/20240223152827.5f9f78e2@gandalf.local.home Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Signed-off-by: Steven Rostedt (Google) --- samples/trace_events/trace-events-sample.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index f2d2d56ce8e2..2dfaf7fc7bfa 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h @@ -303,6 +303,7 @@ TRACE_EVENT(foo_bar, __bitmask( cpus, num_possible_cpus() ) __cpumask( cpum ) __vstring( vstr, fmt, va ) + __string_len( lstr, foo, bar / 2 < strlen(foo) ? bar / 2 : strlen(foo) ) ), TP_fast_assign( @@ -311,12 +312,13 @@ TRACE_EVENT(foo_bar, memcpy(__get_dynamic_array(list), lst, __length_of(lst) * sizeof(int)); __assign_str(str, string); + __assign_str(lstr, foo); __assign_vstr(vstr, fmt, va); __assign_bitmask(cpus, cpumask_bits(mask), num_possible_cpus()); __assign_cpumask(cpum, cpumask_bits(mask)); ), - TP_printk("foo %s %d %s %s %s %s (%s) (%s) %s", __entry->foo, __entry->bar, + TP_printk("foo %s %d %s %s %s %s %s (%s) (%s) %s", __entry->foo, __entry->bar, /* * Notice here the use of some helper functions. This includes: @@ -360,7 +362,8 @@ TRACE_EVENT(foo_bar, __print_array(__get_dynamic_array(list), __get_dynamic_array_len(list) / sizeof(int), sizeof(int)), - __get_str(str), __get_bitmask(cpus), __get_cpumask(cpum), + __get_str(str), __get_str(lstr), + __get_bitmask(cpus), __get_cpumask(cpum), __get_str(vstr)) ); From patchwork Mon Feb 26 18:49:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 206854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2268076dyb; Mon, 26 Feb 2024 10:48:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+xLVsNCHaBleaDVAIAPMQLhnt5bjBVhoXRhSM3VQDTiS6BiALfummcVHJYSuW8f+vhhKRROKL13rs2BQ1OT+oD5Pa5Q== X-Google-Smtp-Source: AGHT+IE7T59cX2GOlTtryL9QB6JH5OQWjjZIEIHZMM/oGMmYKurLCDsx8HKcdTjAjdRvo4MK2SVN X-Received: by 2002:a05:622a:44a:b0:42e:74a8:57ce with SMTP id o10-20020a05622a044a00b0042e74a857cemr8301421qtx.41.1708973330112; Mon, 26 Feb 2024 10:48:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973330; cv=pass; d=google.com; s=arc-20160816; b=nOtywZCpC4kBQmNhJwsgCsSEL2GXzET0uEFej68AQiXp3tXu9ELe+qoFV8l/ToLXyj PmS43fzEl2QsaeoQ/v+dd8K6Tw1toJ/EhVXFQSRqT22qlwWOb14Ok6cEjWaCrEY5dsei /lcU65ToNLeUVFqVlgcXECrtUfpM0GkCytcqXH+2tFAELIFrqft8cdsBWM7UxsqlR0LS KdUybJFfHJ/K9oChyQfn3/dk2o8lQyJkmtZydbKdgX/c5c1FZeI/a1elKj6B/WHKsWgI nmZtHe9vbN9gTGZoD0Pw7pX+4+92KnPgpVzcHd3hrnys5o6hR+TEFiW9iaetMJf9f/gq 4S0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=WU7n3KWtXCv+LQcTdMMLqdBGyHdj2Zm/EBoQU6C55xs=; fh=mTYg3JJ8i2GBNLFt8qb4bgYwOyk0kmrOzICLbi6qJ1c=; b=u6k5lDf889dVI9NHuiGwhCpbhBraFNnhpX19v5sJ2J4cqZG+cbZvgN+6LnasvnJQ8A k9VYZhIognQWdeJc3FnUQMLvcsJ9z7Lwh9VatkGakZpx03qBQdWIyK+2HDRH6UsfiQIE yPfGSkx8iM6VK9KFtyTqbj3CWgUqu9X7Ws5Kcv8ylWdZYOiNfW5D2t5NkmdORDWagvEK sNG4tYxUt1Ul94s75jrPDUjWaQwAcMDqGIlLooB56caysboENqbJkABQlPnVTNYh6s/T HsMgknAjMlCdq3bewDPPUuJ/jdbg6JV0Q5Psqs8y1D+aG4FY67j+q64C4EDHSgZTx1Zn JL6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82158-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82158-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f41-20020a05622a1a2900b0042dd382928fsi6101518qtb.356.2024.02.26.10.48.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:48:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82158-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82158-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82158-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E33471C2409A for ; Mon, 26 Feb 2024 18:48:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E7CF130AF9; Mon, 26 Feb 2024 18:47:53 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 633E012F39B for ; Mon, 26 Feb 2024 18:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; cv=none; b=O7ClPWzF7xl1wMDeLDZrNCkZHqgFr346q8YF0Fh+EURdwxVHbVcntjFI54rQNKmsyRa6fujnAYRXvEp6Y9z0EpSSp/E6yfgljumgNpmPOBPVDqqa765c9aq2RF4fUBNgSbP8Mdxzj7pbf1uNSPFP6El/5kQ5dh/gc5s8Artdgws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; c=relaxed/simple; bh=8Nw3++8KqkLBDEGgcPa6Hj7GfV5L5E4uJvDO01jI9ng=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=AqKaBSyut2TQCNl4W7JxrHVzqlnKVX6DhrximeXTo0hN7tXJXiOW1Tu1C64RjpOMj+TbrRoMb2oZvqP9y6JAtCoVQ4aV35nMPbNs6jogcLFuAcG5t8xhURJc6qrI38Rb9N2q1RBL8otAnC8vqNEincAoNVtlTjvFIYIKeTr1Lvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 035BCC43601; Mon, 26 Feb 2024 18:47:51 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1reg2x-000000090av-1qPA; Mon, 26 Feb 2024 13:49:51 -0500 Message-ID: <20240226184951.297987021@goodmis.org> User-Agent: quilt/0.67 Date: Mon, 26 Feb 2024 13:49:36 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 4/5] tracing: Add warning if string in __assign_str() does not match __string() References: <20240226184932.303400070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791988418447440464 X-GMAIL-MSGID: 1791988418447440464 From: "Steven Rostedt (Google)" In preparation to remove the second parameter of __assign_str(), make sure it is really a duplicate of __string() by adding a WARN_ON_ONCE(). Link: https://lore.kernel.org/linux-trace-kernel/20240223161356.63b72403@gandalf.local.home Cc: Mathieu Desnoyers Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- include/trace/stages/stage6_event_callback.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h index 0c0f50bcdc56..935608971899 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -35,6 +35,7 @@ do { \ char *__str__ = __get_str(dst); \ int __len__ = __get_dynamic_array_len(dst) - 1; \ + WARN_ON_ONCE((src) != __data_offsets.dst##_ptr_); \ memcpy(__str__, __data_offsets.dst##_ptr_ ? : \ EVENT_NULL_STR, __len__); \ __str__[__len__] = '\0'; \ From patchwork Mon Feb 26 18:49:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 206855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2268211dyb; Mon, 26 Feb 2024 10:49:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUfutW9i1tiUN8DaiODWCsVa1lIh/FcbsXJfOlKnlz+kMBcG18chG/97mHLNvfbULWrr5k8C2JlvGeALV7Zo9q7WXgsAA== X-Google-Smtp-Source: AGHT+IHhsCs23F2OoO0932uaIP05Vbs5yubwRwHVJIKQoho9MxzDnM9EvOUcUCOMUz7Ex1t/L77h X-Received: by 2002:a05:6a21:2d06:b0:1a0:eea4:c612 with SMTP id tw6-20020a056a212d0600b001a0eea4c612mr8625pzb.11.1708973351101; Mon, 26 Feb 2024 10:49:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973351; cv=pass; d=google.com; s=arc-20160816; b=paX3CqMCdhBquIVZFqw6Fs2JMpKKnArFVxDn5Uo5DTdzpTGZUrNiICCZXHnf8AlGHN 40mxsHA0I2jgXm+hz/M2Gd86B4no90BcNohUeVlpS6gjskVLhTLAVkUfFbaRzdDkLWZw WbY3e35yFrT2bqxxkjI5vSUsZxyxeWFWrRmytKrZaReaPN9LnW0BIrXQzsaIfCgCyw5z AmrBg8hmCYwI/i6v/3rmzzhIMAKVQWQ48+RQcHj+GQinryyvkWESn8aEmLDhgklfEWMF 20FIj/8VzfgF9zUKt2qofUxP33JiynMOMfQVkP6zUscT9O8HKDMZTbPeQS37FUmYHFWU SnAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=Fb+AhmMKYZJCaIkzLf91E/McdT8osvASEC3gea/QDik=; fh=mTYg3JJ8i2GBNLFt8qb4bgYwOyk0kmrOzICLbi6qJ1c=; b=xJ4KX3zzlZaDg+tH+UDFLKL5RTODZ+mRSiNvDoGPsUCow+4kq3ns0fGOEgGWW/7v/O wA9ze4qMXKvZTm5cS/Ef7Gt4WFw43k/VuLT5BFy6bW5C079RhncUJpb+nrt0mf8xjpqv BRob2V/nBXdRYd2EDXZ4s9XecLrl5t+VegTp+WHALg1UVzwyPKk5rHAGrO5W48xNxpEq myTwuafYdNRDH1NuqIDf6MtHVdto4YxACbNTIvbM4W5pDGm2xZDbtdkqcFpUF980TVbd 4l9lRotDDu1fSXt1m2/rjjgVBJ/92wse1gVwdxRqWKlzuh1DWClXnlAG7WxMOdvlp7i9 r0iQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82159-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82159-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u6-20020a170903124600b001dc730e11bcsi23460plh.489.2024.02.26.10.49.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:49:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82159-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82159-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82159-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E218E2901D7 for ; Mon, 26 Feb 2024 18:49:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 713DB130E4D; Mon, 26 Feb 2024 18:47:54 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8186C12F59F for ; Mon, 26 Feb 2024 18:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; cv=none; b=R9YegZS+nmaK7MIrzbEOL/jBOi//3bVvmZPkBZ+JlKtgnGXreNM7y2+OnQcDeKcd/8V+C5yGtDs08+LNB7eUbTqPAwDiGDemlbAFQEeZPX/OlD2/DEHzYeerZgFmCrjFj1CS9CKLYU/RSZhCYc8RLl/FSV2mQ51A/e9M7SEThYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973271; c=relaxed/simple; bh=6vxNuCJhE20SNjmJNgdjljhBB1xNE4nu9UBSoxje/d4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=VMbTXXuuInguw7jXsgBFrT3VLs8kdQuuGj+LjWBA558YwtdGGqkKQzGw3UKjHfDpqSYIHduTyKSBQWzSM+UyVdU9nHSYj6Fy6j/Ak6eNH+JY8B1diy0076CW1JA7rs+TMgnw1QiBjURNYhakH40wjarQRv7Wd2LidnwQR+Prk7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 322C8C43609; Mon, 26 Feb 2024 18:47:51 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1reg2x-000000090bP-2VIq; Mon, 26 Feb 2024 13:49:51 -0500 Message-ID: <20240226184951.460548167@goodmis.org> User-Agent: quilt/0.67 Date: Mon, 26 Feb 2024 13:49:37 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 5/5] tracing: Remove second parameter to __assign_rel_str() References: <20240226184932.303400070@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791988440893524473 X-GMAIL-MSGID: 1791988440893524473 From: "Steven Rostedt (Google)" The second parameter of __assign_rel_str() is no longer used. It can be removed. Note, the only real users of rel_string is user events. This code is just in the sample code for testing purposes. This makes __assign_rel_str() different than __assign_str() but that's fine. __assign_str() is used over 700 places and has a larger impact. That change will come later. Link: https://lore.kernel.org/linux-trace-kernel/20240223162519.2beb8112@gandalf.local.home Cc: Mathieu Desnoyers Reviewed-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- include/trace/stages/stage6_event_callback.h | 2 +- samples/trace_events/trace-events-sample.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h index 935608971899..a0c15f67eabe 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -91,7 +91,7 @@ #define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -1) #undef __assign_rel_str -#define __assign_rel_str(dst, src) \ +#define __assign_rel_str(dst) \ do { \ char *__str__ = __get_rel_str(dst); \ int __len__ = __get_rel_dynamic_array_len(dst) - 1; \ diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h index 2dfaf7fc7bfa..500981eca74d 100644 --- a/samples/trace_events/trace-events-sample.h +++ b/samples/trace_events/trace-events-sample.h @@ -574,7 +574,7 @@ TRACE_EVENT(foo_rel_loc, ), TP_fast_assign( - __assign_rel_str(foo, foo); + __assign_rel_str(foo); __entry->bar = bar; __assign_rel_bitmask(bitmask, mask, BITS_PER_BYTE * sizeof(unsigned long));