Re: [GIT PULL] orphaned patches for 6.11

From: Tetsuo Handa
Date: Thu Jul 25 2024 - 07:07:16 EST


On 2024/07/25 14:11, Linus Torvalds wrote:
> So no. This is not happening, and you just showed exactly why nobody
> wants to take your patch set. Because you make things more complicated
> than they need to be for no reason.

I'm sending you as a patch set. But that is a result of nobody taking care
on individual patch (even fine-and-simple the other patch). People fixing
unpopular bugs are having difficulty with finding maintainers or getting
responses from maintainers (regardless of whether individual patch is
complicated). For example,
https://lkml.kernel.org/r/20230423012744.24320-1-chenzhongjin@xxxxxxxxxx was
a result of several comments but still not accepted. I appreciate if you can
help such people with persuading appropriate maintainers to review/accept.

> And yes, apparently we should just also move the 'prof_buffer' test
> earlier, and do it in profile_tick() too, so that we don't need to
> even worry about the cpumask_available thing.

Do you mean

void profile_tick(int type)
{
struct pt_regs *regs = get_irq_regs();

- if (!user_mode(regs) && cpumask_available(prof_cpu_mask) &&
+ if (!user_mode(regs) && prof_buffer &&
cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
profile_hit(type, (void *)profile_pc(regs));
}

because prof_cpu_mask != NULL is guaranteed if prof_buffer != NULL
because prof_cpu_mask is assigned before prof_buffer is assigned and
prof_buffer is never reassigned? That resembles
https://lkml.kernel.org/r/20230410022226.181812-3-chenzhongjin@xxxxxxxxxx
but Chen Zhongjin did not remove the cpumask_available() test.

Can that change survive memory fetch reordering like

if (!user_mode(regs) &&
cpumask_test_cpu(smp_processor_id(), prof_cpu_mask) &&
prof_buffer)
profile_hit(type, (void *)profile_pc(regs));

if cpumask_available() test is removed? We after all cannot forget about
the cpumask_available thing?

If we can forget about the cpumask_available thing, can we tolerate discarding
CONFIG_CPUMASK_OFFSTACK=n optimization because we can't remove duplicated
prof_buffer != NULL test in profile_hits() because do_profile_hits() assumes
that prof_buffer != NULL?

Conditions/preferences are too much complicated...