mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rong Chen <rong.a.chen@intel.com>
To: paulmck@kernel.org, kernel test robot <lkp@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	lkp@lists.01.org
Subject: Re: [LKP] Re: [rcuperf] 4e88ec4a9e: UBSAN:division-overflow_in_arch/x86/include/asm/div64.h
Date: Tue, 1 Sep 2020 15:03:28 +0800	[thread overview]
Message-ID: <649fd850-602f-7f0d-d286-73a8dd88ad6d@intel.com> (raw)
In-Reply-To: <20200831155037.GZ2855@paulmck-ThinkPad-P72>



On 8/31/20 11:50 PM, Paul E. McKenney wrote:
> On Mon, Aug 31, 2020 at 08:01:22PM +0800, kernel test robot wrote:
>> Greeting,
>>
>> FYI, we noticed the following commit (built with gcc-9):
>>
>> commit: 4e88ec4a9eb17527e640b063f79e5b875733eb53 ("rcuperf: Change rcuperf to rcuscale")
>> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
>>
>>
>> in testcase: trinity
>> with following parameters:
>>
>> 	runtime: 300s
>>
>> test-description: Trinity is a linux system call fuzz tester.
>> test-url: http://codemonkey.org.uk/projects/trinity/
>>
>>
>> on test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 2 -m 8G
>>
>> caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
>>
>>
>> +---------------------------------------------------------+------------+------------+
>> |                                                         | 65bd77f554 | 4e88ec4a9e |
>> +---------------------------------------------------------+------------+------------+
>> | boot_successes                                          | 13         | 0          |
>> | boot_failures                                           | 0          | 14         |
>> | UBSAN:division-overflow_in_arch/x86/include/asm/div64.h | 0          | 14         |
>> | error:#[##]                                             | 0          | 14         |
>> | EIP:main_func.cold                                      | 0          | 14         |
>> | Kernel_panic-not_syncing:Fatal_exception                | 0          | 14         |
>> +---------------------------------------------------------+------------+------------+
>>
>>
>> If you fix the issue, kindly add following tag
>> Reported-by: kernel test robot <lkp@intel.com>
> Does the patch below fix this for you?

Yes, this patch can fix the issue, and nreaders was adjusted to 1:

[    5.953645] The force parameter has not been set to 1. The Iris 
poweroff handler will not be installed.
[   12.546587] rcu-ref-scale: --- Start of test:  verbose=0 shutdown=1 
holdoff=10 loops=10000 nreaders=-1 nruns=30 readdelay=0
[   12.561495] ------------[ cut here ]------------
[   12.562016] ref_scale_init: nreaders = 0, adjusted to 1
[   12.562601] WARNING: CPU: 0 PID: 1 at kernel/rcu/refscale.c:684 
ref_scale_init+0x653/0x80

Best Regards,
Rong Chen

>
> 							Thanx, Paul
>
> ------------------------------------------------------------------------
>
> commit d301e320e952e2e604d83d9540e52510b0eb3d94
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Thu Aug 27 09:58:19 2020 -0700
>
>      refscale: Bounds-check module parameters
>      
>      The default value for refscale.nreaders is -1, which results in the code
>      setting the value to three-quarters of the number of CPUs.  On single-CPU
>      systems, this results in three-quarters of the value one, which the C
>      language's integer arithmetic rounds to zero.  This in turn results in
>      a divide-by-zero error.
>      
>      This commit therefore adds bounds checking to the refscale module
>      parameters, so that if they are less than one, they are set to the
>      value one.
>      
>      Reported-by: kernel test robot <lkp@intel.com>
>      Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> index 952595c..fb5f20d 100644
> --- a/kernel/rcu/refscale.c
> +++ b/kernel/rcu/refscale.c
> @@ -681,6 +681,12 @@ ref_scale_init(void)
>   	// Reader tasks (default to ~75% of online CPUs).
>   	if (nreaders < 0)
>   		nreaders = (num_online_cpus() >> 1) + (num_online_cpus() >> 2);
> +	if (WARN_ONCE(loops <= 0, "%s: loops = %ld, adjusted to 1\n", __func__, loops))
> +		loops = 1;
> +	if (WARN_ONCE(nreaders <= 0, "%s: nreaders = %d, adjusted to 1\n", __func__, nreaders))
> +		nreaders = 1;
> +	if (WARN_ONCE(nruns <= 0, "%s: nruns = %d, adjusted to 1\n", __func__, nruns))
> +		nruns = 1;
>   	reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
>   			       GFP_KERNEL);
>   	if (!reader_tasks) {
> _______________________________________________
> LKP mailing list -- lkp@lists.01.org
> To unsubscribe send an email to lkp-leave@lists.01.org


  reply	other threads:[~2020-09-01  7:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 12:01 kernel test robot
2020-08-31 15:50 ` Paul E. McKenney
2020-09-01  7:03   ` Rong Chen [this message]
2020-09-01 16:27     ` [LKP] " Paul E. McKenney
2020-09-02  4:34       ` Chen, Rong A

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=649fd850-602f-7f0d-d286-73a8dd88ad6d@intel.com \
    --to=rong.a.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@kernel.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

all inboxes | Powered by JetHome®