linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace: Do some cleanups for osnoise tracer
@ 2021-09-13  3:32 Tang Yizhou
  2021-09-13  7:59 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tang Yizhou @ 2021-09-13  3:32 UTC (permalink / raw)
  To: bristot, rostedt; +Cc: mingo, linux-kernel, tangyizhou

1. Add 'static' and 'const' qualifier when necessary.
2. Use DEFINE_MUTEX() to define a mutex.

Signed-off-by: Tang Yizhou <tangyizhou@huawei.com>
---
 kernel/trace/trace_osnoise.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index ce053619f289..c1a8dc6a154e 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -105,7 +105,7 @@ struct osnoise_variables {
 /*
  * Per-cpu runtime information.
  */
-DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
+static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
 
 /*
  * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
@@ -128,7 +128,7 @@ struct timerlat_variables {
 	u64			count;
 };
 
-DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
+static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
 
 /*
  * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
@@ -220,7 +220,7 @@ struct timerlat_sample {
 /*
  * Protect the interface.
  */
-struct mutex interface_lock;
+static DEFINE_MUTEX(interface_lock);
 
 /*
  * Tracer data.
@@ -1818,8 +1818,8 @@ static struct trace_min_max_param osnoise_print_stack = {
 /*
  * osnoise/timerlat_period: min 100 us, max 1 s
  */
-u64 timerlat_min_period = 100;
-u64 timerlat_max_period = 1000000;
+static const u64 timerlat_min_period = 100;
+static const u64 timerlat_max_period = 1000000;
 static struct trace_min_max_param timerlat_period = {
 	.lock	= &interface_lock,
 	.val	= &osnoise_data.timerlat_period,
@@ -2087,8 +2087,6 @@ __init static int init_osnoise_tracer(void)
 {
 	int ret;
 
-	mutex_init(&interface_lock);
-
 	cpumask_copy(&osnoise_cpumask, cpu_all_mask);
 
 	ret = register_tracer(&osnoise_tracer);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] trace: Do some cleanups for osnoise tracer
  2021-09-13  3:32 [PATCH] trace: Do some cleanups for osnoise tracer Tang Yizhou
@ 2021-09-13  7:59 ` kernel test robot
  2021-09-13  8:53 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-09-13  7:59 UTC (permalink / raw)
  To: Tang Yizhou, bristot, rostedt; +Cc: kbuild-all, mingo, linux-kernel, tangyizhou

[-- Attachment #1: Type: text/plain, Size: 3019 bytes --]

Hi Tang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/perf/core]
[also build test WARNING on v5.15-rc1 next-20210913]
[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]

url:    https://github.com/0day-ci/linux/commits/Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 4034fb207e302cc0b1f304084d379640c1fb1436
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/cecf38d3b5e23a411856f6c8f3e3be903e439876
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
        git checkout cecf38d3b5e23a411856f6c8f3e3be903e439876
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

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_osnoise.c:1826:9: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    1826 |  .max = &timerlat_max_period,
         |         ^
   kernel/trace/trace_osnoise.c:1827:9: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    1827 |  .min = &timerlat_min_period,
         |         ^


vim +/const +1826 kernel/trace/trace_osnoise.c

a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1817  
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1818  /*
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1819   * osnoise/timerlat_period: min 100 us, max 1 s
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1820   */
cecf38d3b5e23a Tang Yizhou                2021-09-13  1821  static const u64 timerlat_min_period = 100;
cecf38d3b5e23a Tang Yizhou                2021-09-13  1822  static const u64 timerlat_max_period = 1000000;
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1823  static struct trace_min_max_param timerlat_period = {
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1824  	.lock	= &interface_lock,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1825  	.val	= &osnoise_data.timerlat_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22 @1826  	.max	= &timerlat_max_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1827  	.min	= &timerlat_min_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1828  };
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1829  #endif
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1830  

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65003 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] trace: Do some cleanups for osnoise tracer
  2021-09-13  3:32 [PATCH] trace: Do some cleanups for osnoise tracer Tang Yizhou
  2021-09-13  7:59 ` kernel test robot
@ 2021-09-13  8:53 ` kernel test robot
  2021-09-13 10:05 ` kernel test robot
  2021-09-13 14:58 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-09-13  8:53 UTC (permalink / raw)
  To: Tang Yizhou, bristot, rostedt; +Cc: kbuild-all, mingo, linux-kernel, tangyizhou

[-- Attachment #1: Type: text/plain, Size: 3505 bytes --]

Hi Tang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/perf/core]
[also build test WARNING on v5.15-rc1 next-20210913]
[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]

url:    https://github.com/0day-ci/linux/commits/Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 4034fb207e302cc0b1f304084d379640c1fb1436
config: i386-randconfig-s001-20210912 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/cecf38d3b5e23a411856f6c8f3e3be903e439876
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
        git checkout cecf38d3b5e23a411856f6c8f3e3be903e439876
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_osnoise.c:1826:20: sparse: sparse: incorrect type in initializer (different modifiers) @@     expected unsigned long long [usertype] *max @@     got unsigned long long const * @@
   kernel/trace/trace_osnoise.c:1826:20: sparse:     expected unsigned long long [usertype] *max
   kernel/trace/trace_osnoise.c:1826:20: sparse:     got unsigned long long const *
>> kernel/trace/trace_osnoise.c:1827:20: sparse: sparse: incorrect type in initializer (different modifiers) @@     expected unsigned long long [usertype] *min @@     got unsigned long long const * @@
   kernel/trace/trace_osnoise.c:1827:20: sparse:     expected unsigned long long [usertype] *min
   kernel/trace/trace_osnoise.c:1827:20: sparse:     got unsigned long long const *

vim +1826 kernel/trace/trace_osnoise.c

a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1817  
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1818  /*
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1819   * osnoise/timerlat_period: min 100 us, max 1 s
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1820   */
cecf38d3b5e23a41 Tang Yizhou                2021-09-13  1821  static const u64 timerlat_min_period = 100;
cecf38d3b5e23a41 Tang Yizhou                2021-09-13  1822  static const u64 timerlat_max_period = 1000000;
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1823  static struct trace_min_max_param timerlat_period = {
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1824  	.lock	= &interface_lock,
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1825  	.val	= &osnoise_data.timerlat_period,
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22 @1826  	.max	= &timerlat_max_period,
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22 @1827  	.min	= &timerlat_min_period,
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1828  };
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1829  #endif
a955d7eac1779b43 Daniel Bristot de Oliveira 2021-06-22  1830  

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39990 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] trace: Do some cleanups for osnoise tracer
  2021-09-13  3:32 [PATCH] trace: Do some cleanups for osnoise tracer Tang Yizhou
  2021-09-13  7:59 ` kernel test robot
  2021-09-13  8:53 ` kernel test robot
@ 2021-09-13 10:05 ` kernel test robot
  2021-09-13 14:58 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-09-13 10:05 UTC (permalink / raw)
  To: Tang Yizhou, bristot, rostedt
  Cc: llvm, kbuild-all, mingo, linux-kernel, tangyizhou

[-- Attachment #1: Type: text/plain, Size: 3561 bytes --]

Hi Tang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v5.15-rc1 next-20210913]
[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]

url:    https://github.com/0day-ci/linux/commits/Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 4034fb207e302cc0b1f304084d379640c1fb1436
config: i386-randconfig-r005-20210912 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/cecf38d3b5e23a411856f6c8f3e3be903e439876
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tang-Yizhou/trace-Do-some-cleanups-for-osnoise-tracer/20210913-111459
        git checkout cecf38d3b5e23a411856f6c8f3e3be903e439876
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/trace/trace_osnoise.c:1826:9: error: initializing 'u64 *' (aka 'unsigned long long *') with an expression of type 'const u64 *' (aka 'const unsigned long long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           .max    = &timerlat_max_period,
                     ^~~~~~~~~~~~~~~~~~~~
   kernel/trace/trace_osnoise.c:1827:9: error: initializing 'u64 *' (aka 'unsigned long long *') with an expression of type 'const u64 *' (aka 'const unsigned long long *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           .min    = &timerlat_min_period,
                     ^~~~~~~~~~~~~~~~~~~~
   2 errors generated.


vim +1826 kernel/trace/trace_osnoise.c

a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1817  
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1818  /*
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1819   * osnoise/timerlat_period: min 100 us, max 1 s
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1820   */
cecf38d3b5e23a Tang Yizhou                2021-09-13  1821  static const u64 timerlat_min_period = 100;
cecf38d3b5e23a Tang Yizhou                2021-09-13  1822  static const u64 timerlat_max_period = 1000000;
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1823  static struct trace_min_max_param timerlat_period = {
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1824  	.lock	= &interface_lock,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1825  	.val	= &osnoise_data.timerlat_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22 @1826  	.max	= &timerlat_max_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1827  	.min	= &timerlat_min_period,
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1828  };
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1829  #endif
a955d7eac1779b Daniel Bristot de Oliveira 2021-06-22  1830  

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40580 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] trace: Do some cleanups for osnoise tracer
  2021-09-13  3:32 [PATCH] trace: Do some cleanups for osnoise tracer Tang Yizhou
                   ` (2 preceding siblings ...)
  2021-09-13 10:05 ` kernel test robot
@ 2021-09-13 14:58 ` Steven Rostedt
  3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2021-09-13 14:58 UTC (permalink / raw)
  To: Tang Yizhou; +Cc: bristot, mingo, linux-kernel

On Mon, 13 Sep 2021 11:32:06 +0800
Tang Yizhou <tangyizhou@huawei.com> wrote:

> 1. Add 'static' and 'const' qualifier when necessary.
> 2. Use DEFINE_MUTEX() to define a mutex.
> 
> Signed-off-by: Tang Yizhou <tangyizhou@huawei.com>
> ---
>  kernel/trace/trace_osnoise.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index ce053619f289..c1a8dc6a154e 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -105,7 +105,7 @@ struct osnoise_variables {
>  /*
>   * Per-cpu runtime information.
>   */
> -DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
> +static DEFINE_PER_CPU(struct osnoise_variables, per_cpu_osnoise_var);
>  
>  /*
>   * this_cpu_osn_var - Return the per-cpu osnoise_variables on its relative CPU
> @@ -128,7 +128,7 @@ struct timerlat_variables {
>  	u64			count;
>  };
>  
> -DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
> +static DEFINE_PER_CPU(struct timerlat_variables, per_cpu_timerlat_var);
>  
>  /*
>   * this_cpu_tmr_var - Return the per-cpu timerlat_variables on its relative CPU
> @@ -220,7 +220,7 @@ struct timerlat_sample {
>  /*
>   * Protect the interface.
>   */
> -struct mutex interface_lock;
> +static DEFINE_MUTEX(interface_lock);
>  
>  /*
>   * Tracer data.
> @@ -1818,8 +1818,8 @@ static struct trace_min_max_param osnoise_print_stack = {
>  /*
>   * osnoise/timerlat_period: min 100 us, max 1 s
>   */
> -u64 timerlat_min_period = 100;
> -u64 timerlat_max_period = 1000000;
> +static const u64 timerlat_min_period = 100;
> +static const u64 timerlat_max_period = 1000000;

Can't be const because it can be modified.

-- Steve

>  static struct trace_min_max_param timerlat_period = {
>  	.lock	= &interface_lock,
>  	.val	= &osnoise_data.timerlat_period,
> @@ -2087,8 +2087,6 @@ __init static int init_osnoise_tracer(void)
>  {
>  	int ret;
>  
> -	mutex_init(&interface_lock);
> -
>  	cpumask_copy(&osnoise_cpumask, cpu_all_mask);
>  
>  	ret = register_tracer(&osnoise_tracer);


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-13 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  3:32 [PATCH] trace: Do some cleanups for osnoise tracer Tang Yizhou
2021-09-13  7:59 ` kernel test robot
2021-09-13  8:53 ` kernel test robot
2021-09-13 10:05 ` kernel test robot
2021-09-13 14:58 ` Steven Rostedt

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