Re: [RFC PATCH 14/16] irq: Add support for core-wide protection of IRQ and softirq

From: Thomas Gleixner
Date: Mon Jul 20 2020 - 04:20:51 EST


Joel,

Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> writes:
> On Sat, Jul 18, 2020 at 01:36:16AM +0200, Thomas Gleixner wrote:
>>
>> The entry case condition wants to have a TIF bit as well, i.e.
>>
>> if (thread_test_bit(TIF_CORE_SCHED_REQUIRED) {
>> sched_ipi_dance() {
>> if (other_sibling_in_user_or_guest())
>> send_IPI();
>> }
>> }
>
> I did not understand this bit. Could you explain more about it? Are you
> talking about the IPIs sent from the schedule() loop in this series?

Nah, let me try again. If two tasks are out in user space (or guest
mode) and they fall under the isolation rule that they either are both
in user space or both in the kernel then you tag both with
TIF_CORE_SCHED_REQUIRED or whatever bit is appropriate.

So in entry from user you do:

if (thread_test_bit(TIF_CORE_SCHED_REQUIRED))
sched_orchestrate_entry();

void sched_orchestrate_entry(void)
{
if (other_sibling_in_user_or_guest())
send_IPI_to_sibling();
}

That IPI brings the sibling out of user or guest mode.

On the way back to user/guest you do:

if (thread_test_bit(TIF_CORE_SCHED_REQUIRED))
sched_orchestrate_exit();

void sched_orchestrate_exit(void)
{
while (other_sibling_in_kernel())
twiddle_thumbs();
}

Hope that clarifies it.

Thanks,

tglx