Re: [PATCH v2 3/8] drm/i915: Don't check for atomic context on PREEMPT_RT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024-06-14 09:32:07 [+0100], Tvrtko Ursulin wrote:
> I think this could be okay-ish in principle, but the commit text is not
> entirely accurate because there is no direct coupling between the wait
> helpers and the uncore lock. They can be used from any atomic context.
> 
> Okay-ish in principle because there is sufficient testing in Intel's CI on
> non-PREEMPT_RT kernels to catch any conceptual misuses.

You just avoid disabling preemption if you expect to be in atomic
context to save a few cycles. It wouldn't hurt to disable it anyway. The
only reason you need it is to remain on the same CPU while reading the
clock because it is not guaranteed otherwise.

Delays > 50ms are detected at build time.

> But see also the caller in skl_pcode_request. It is a bit harder to hit
> since it is the fallback path. Or gen5_rps_enable which nests under a
> different lock.
> 
> Hmm would there be a different helper, or combination of helpers, which
> could replace in_atomic() which would do the right thing on both kernels?
> Something to tell us we are neither under a spin_lock, nor preempt_disable,
> nor interrupts disabled, nor bottom-half. On either stock or PREEMPT_RT.

There is nothing that you can use to deduct that you are under a
spin-lock. preemptible() works only if you have a preemption counter
which is not mandatory. It can affect RCU but not in all configurations.

> WARN_ON_ONCE((ATOMIC) && !(!preemptible() || in_hardirq() ||
> in_serving_softirq())
> 
> Would this work?

Nope. None of this triggers if you acquire a spinlock_t. And I can't
think of something that would always be true.

So the question is why do you need to know if the context is atomic?
The only impact is avoiding disabling preemption. Is it that important
to avoid it?
If so would cant_migrate() work? It requires CONFIG_DEBUG_ATOMIC_SLEEP=y
to do the trick.

> Regards,
> 
> Tvrtko

Sebastian



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux