2014-01-02 01:36:22

by Xishi Qiu

[permalink] [raw]
Subject: Re: [PATCH] mm: add a new command-line kmemcheck value

On 2013/12/31 18:12, Vegard Nossum wrote:

> (Oops, resend to restore Cc.)
>
> Hi,
>
> On 31 December 2013 09:32, Xishi Qiu <[email protected]> wrote:
>> Add a new command-line kmemcheck value: kmemcheck=3 (disable the feature),
>> this is the same effect as CONFIG_KMEMCHECK disabled.
>> After doing this, we can enable/disable kmemcheck feature in one vmlinux.
>
> Could you please explain what exactly the difference is between the
> existing kmemcheck=0 parameter and the new kmemcheck=3?
>
> Thanks,
>
>
> Vegard
>

Hi Vegard,

kmemcheck=0: enable kmemcheck feature, but don't check the memory.
and the OS use only one cpu.(setup_max_cpus = 1)
kmemcheck=3: disable kmemcheck feature.
this is the same effect as CONFIG_KMEMCHECK disabled.
OS will use cpus as many as possible.

Thanks,
Xishi Qiu




2014-01-10 16:02:44

by Vegard Nossum

[permalink] [raw]
Subject: Re: [PATCH] mm: add a new command-line kmemcheck value

On 2 January 2014 02:34, Xishi Qiu <[email protected]> wrote:
> On 2013/12/31 18:12, Vegard Nossum wrote:
>> On 31 December 2013 09:32, Xishi Qiu <[email protected]> wrote:
>>> Add a new command-line kmemcheck value: kmemcheck=3 (disable the feature),
>>> this is the same effect as CONFIG_KMEMCHECK disabled.
>>> After doing this, we can enable/disable kmemcheck feature in one vmlinux.
>>
>> Could you please explain what exactly the difference is between the
>> existing kmemcheck=0 parameter and the new kmemcheck=3?
>
> kmemcheck=0: enable kmemcheck feature, but don't check the memory.
> and the OS use only one cpu.(setup_max_cpus = 1)
> kmemcheck=3: disable kmemcheck feature.
> this is the same effect as CONFIG_KMEMCHECK disabled.
> OS will use cpus as many as possible.
>

I see. In that case, I think it's better to allow all the CPUs to keep
running while kmemcheck is disabled with kmemcheck=0 boot parameter,
and offline them when/if kmemcheck is reenabled via
/proc/sys/kernel/kmemcheck.


Vegard

2014-01-22 01:24:42

by Xishi Qiu

[permalink] [raw]
Subject: Re: [PATCH] mm: add a new command-line kmemcheck value

On 2014/1/11 0:02, Vegard Nossum wrote:

> On 2 January 2014 02:34, Xishi Qiu <[email protected]> wrote:
>> On 2013/12/31 18:12, Vegard Nossum wrote:
>>> On 31 December 2013 09:32, Xishi Qiu <[email protected]> wrote:
>>>> Add a new command-line kmemcheck value: kmemcheck=3 (disable the feature),
>>>> this is the same effect as CONFIG_KMEMCHECK disabled.
>>>> After doing this, we can enable/disable kmemcheck feature in one vmlinux.
>>>
>>> Could you please explain what exactly the difference is between the
>>> existing kmemcheck=0 parameter and the new kmemcheck=3?
>>
>> kmemcheck=0: enable kmemcheck feature, but don't check the memory.
>> and the OS use only one cpu.(setup_max_cpus = 1)
>> kmemcheck=3: disable kmemcheck feature.
>> this is the same effect as CONFIG_KMEMCHECK disabled.
>> OS will use cpus as many as possible.
>>
>
> I see. In that case, I think it's better to allow all the CPUs to keep
> running while kmemcheck is disabled with kmemcheck=0 boot parameter,
> and offline them when/if kmemcheck is reenabled via
> /proc/sys/kernel/kmemcheck.
>
>
> Vegard
>
>

Hi Vegard,

In some scenes, user want to check memory dynamicly, this "dynamically"
means we can turn on/off the feature at boottime, not runtime. Without
this patch, if user want to use this feature, he should change config
and build the kernel, then reboot. This is impossilbe if user has no
kernel code or he don't know how to build the kernel.

boottime: kmemcheck=0/1/2/3 (command-line)
runtime: kmemcheck=0/1/2 (/proc/sys/kernel/kmemcheck)

The main different between kmemcheck=0 and 3 is the used memory. Kmemcheck
will use about twice as much memory as normal.

Thanks,
Xishi Qiu

2014-02-11 07:19:22

by Xishi Qiu

[permalink] [raw]
Subject: Re: [PATCH] mm: add a new command-line kmemcheck value

On 2014/1/22 9:22, Xishi Qiu wrote:

>
> Hi Vegard,
>
> In some scenes, user want to check memory dynamicly, this "dynamically"
> means we can turn on/off the feature at boottime, not runtime. Without
> this patch, if user want to use this feature, he should change config
> and build the kernel, then reboot. This is impossilbe if user has no
> kernel code or he don't know how to build the kernel.
>
> boottime: kmemcheck=0/1/2/3 (command-line)
> runtime: kmemcheck=0/1/2 (/proc/sys/kernel/kmemcheck)
>
> The main different between kmemcheck=0 and 3 is the used memory. Kmemcheck
> will use about twice as much memory as normal.
>
> Thanks,
> Xishi Qiu
>
> --

Hi Vegard,

What do you think of this feature?

Add a command-line "kmemcheck=3", then the kernel runs as the same as CONFIG_KMEMCHECK=off
even CONFIG_KMEMCHECK is turn on. "kmemcheck=0/1/2" is the same as originally.
In another word, "kmemcheck=3" is the same as:
1) turn off CONFIG_KMEMCHECK
2) rebuild the kernel
3) reboot
The different between kmemcheck=0 and 3 is the used memory and nr_cpus.
Also kmemcheck=0 can used in runtime, and kmemcheck=3 is only used in boot.

I think this feature can help users to debug the kernel quickly, It is no
need to open CONFIG_KMEMCHECK and rebuild it. Especially sometimes users don't
have the kernel source code or the code is different from http://www.kernel.org.
e.g. some private features were added to the kernel source code, and usually
users can not have the source code.

Thanks,
Xishi Qiu