Re: [PATCH 2/2] refscale: prevent buffer to pr_alert() being too long

From: lizhijian@xxxxxxxxxxx
Date: Sun Oct 24 2021 - 23:22:46 EST




On 25/10/2021 06:56, Paul E. McKenney wrote:
>
>>>> if (!buf)
>>>> return 0;
>>>> buf[0] = 0;
>>>> @@ -617,13 +617,15 @@ static u64 process_durations(int n)
>>>> if (i % 5 == 0)
>>>> strcat(buf, "\n");
>>>> + if (strlen(buf) > 800) {
>>>> + pr_alert("%s", buf);
>>> Does the tools/testing/selftests/rcutorture/bin/kvm-recheck-refscale.sh
>>> script also require changes to handle the partial lines?
Looks it doesn't matter for kvm-recheck-refscale.sh where it will not check these output.


>>>> u32 rem;
>>>> @@ -712,9 +711,13 @@ static int main_func(void *arg)
>>>> avg = div_u64_rem(result_avg[exp], 1000, &rem);
>>>> sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
>>>> strcat(buf, buf1);
>>>> + if (strlen(buf) > 800) {
>>>> + pr_alert("%s", buf);
>>>> + buf[0] = 0;
>>>> + }
>>>> }
>>>> - SCALEOUT("%s", buf);
>>>> + pr_alert("%s", buf);
it will not introduce partial lines here, buf  is always ended with '\n'

I have checked the regexp in tools/testing/selftests/rcutorture/bin/kvm-recheck-refscale.sh
and verify it with the new result, it always works.


Thanks
Zhijian



>>>> err:
>>>> // This will shutdown everything including us.
>>>> --
>>>> 2.33.0
>>>>
>>>>
>>>>
>>
>