Re: [PATCH v4 7/7] x86/tlb: add tlb_flushall_factor into sysfs foruser testing/tuning

From: Alex Shi
Date: Fri May 11 2012 - 08:53:23 EST


On 05/11/2012 05:51 PM, Borislav Petkov wrote:

> On Fri, May 11, 2012 at 08:52:09AM +0800, Alex Shi wrote:
>>>> +#ifdef CONFIG_DEBUG_TLBFLUSH
>>
>>>> +static ssize_t __tlb_flushall_factor_store(const char *buf,
>>>> + size_t count, int smt)
>>>> +{
>>>> + short factor = 0;
>>>> +
>>>> + if (sscanf(buf, "%hd", &factor) != 1)
>>>> + return -EINVAL;
>>>
>>> This means only single-digit factors, right?
>>
>> No, you can try '32' '16' etc. not a 'single-digit'.
>
> Ah, misread sscanf, nevermind.
>
>>> Why not use kstrtoul?
>>
>> any advantage of this?
>
> Well, sscanf uses simple_strto* and those miss overflow checks etc, see
> 33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c for details.


Thanks for reminder!

>
> Btw, there are other kstrto* functions which you could use to fit better
> the argument type and size passed to tlb_flushall_factor.
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/