sof icon indicating copy to clipboard operation
sof copied to clipboard

dai: remove bogus IRQ disabling in DAI group triggering

Open lyakh opened this issue 2 years ago • 7 comments

Disabling IRQs when sending a notification doesn't seem to be required and is potentially risky if that notification causes re-scheduling.

lyakh avatar Jun 01 '22 06:06 lyakh

Who's the consumer of the notifier message ?

@lgirdwood dai_atomic_trigger() - the notification is used to handle DAI groups. When all DAIs have handled the trigger, that callback is called. TBH I don't even understand why not just call that function directly. The original DAI group commit says, all the DAIs should run on the same core, so effectively anyway the same thing happens: the notifier just calls the callback inline in-place.

lyakh avatar Jun 01 '22 10:06 lyakh

Who's the consumer of the notifier message ?

@lgirdwood dai_atomic_trigger() - the notification is used to handle DAI groups. When all DAIs have handled the trigger, that callback is called. TBH I don't even understand why not just call that function directly. The original DAI group commit says, all the DAIs should run on the same core, so effectively anyway the same thing happens: the notifier just calls the callback inline in-place.

Ok, so if it's all on the same core then we still need local IRQs off e.g. we get an IPC half way through the DAI enable bit setting between SSP0 and SSP1 meaning that SSP ports could be out of sync by 1 or more frames ?

lgirdwood avatar Jun 01 '22 12:06 lgirdwood

Who's the consumer of the notifier message ?

@lgirdwood dai_atomic_trigger() - the notification is used to handle DAI groups. When all DAIs have handled the trigger, that callback is called. TBH I don't even understand why not just call that function directly. The original DAI group commit says, all the DAIs should run on the same core, so effectively anyway the same thing happens: the notifier just calls the callback inline in-place.

Ok, so if it's all on the same core then we still need local IRQs off e.g. we get an IPC half way through the DAI enable bit setting between SSP0 and SSP1 meaning that SSP ports could be out of sync by 1 or more frames ?

@lgirdwood then it should be done inside the callback - where it's really needed, not around the notifier call

lyakh avatar Jun 02 '22 06:06 lyakh

Who's the consumer of the notifier message ?

@lgirdwood dai_atomic_trigger() - the notification is used to handle DAI groups. When all DAIs have handled the trigger, that callback is called. TBH I don't even understand why not just call that function directly. The original DAI group commit says, all the DAIs should run on the same core, so effectively anyway the same thing happens: the notifier just calls the callback inline in-place.

Ok, so if it's all on the same core then we still need local IRQs off e.g. we get an IPC half way through the DAI enable bit setting between SSP0 and SSP1 meaning that SSP ports could be out of sync by 1 or more frames ?

@lgirdwood then it should be done inside the callback - where it's really needed, not around the notifier call

The callback is run for each single physical DAI instance in a loop. How would moving IRQs handling inside the callback help to protect the entire loop for all DAIs from pre-emption?

mmaka1 avatar Jun 03 '22 10:06 mmaka1

The callback is run for each single physical DAI instance in a loop. How would moving IRQs handling inside the callback help to protect the entire loop for all DAIs from pre-emption?

@mmaka1 ok, can we then make it a simple list with a head in the group and a loop over that list? Not using the notifier with its potential scheduling calls

lyakh avatar Jun 07 '22 06:06 lyakh

@lgirdwood we're waiting for a reply from @mmaka1 here

lyakh avatar Jun 09 '22 10:06 lyakh

@mmaka1 @lyakh ping

lgirdwood avatar Jul 07 '22 10:07 lgirdwood

No activity in a long time, converting as draft.

kv2019i avatar Dec 16 '22 11:12 kv2019i

Can one of the admins verify this patch?

sys-pt1s avatar Apr 06 '23 10:04 sys-pt1s