-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASoC: SOF: core/Intel: Follow the pause_supported flag from topology to disable or keep the pause support enabled #5041
ASoC: SOF: core/Intel: Follow the pause_supported flag from topology to disable or keep the pause support enabled #5041
Conversation
Yes, with this PR the PAUSE is going to be mostly disabled for Intel platforms regardless of IPC version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typoe in title "enabeld"
Patch looks good but I wonder if this is ok to change the behaviour for existing systems -- this will go all the way back to CML/CFL systems (and not just Intel).. It's possible somebody is happily using SOF on a system with apps that use pause, and this kernel PR could break their use-case when they upgrade the kernel.
Staged introduction (or disable_pause token in tplg) would be more incremental.
I am not aligned with the approach, sorry. I agree that PAUSE is not a release blocker. but in practice it's the only way to trigger quick transitions and find bugs we wouldn't see otherwise. It's also incorrect to say it's not been tested. What has not been tested is suspend while paused which is a second-order corner case. The net effect of this topology token would be to COMPLETELY disable PAUSE, including in our CI tests. That's different to disabling it for releases, and making an educated decision to avoid spending cycles on problematic issues with no ROI. The topology approach has zero flexibiliity, it's all or nothing. I wouldn't mind if this topology-based approach was contingent on a 'default n' kernel Kconfig, which would only be used by developers and CI tests. I am not ok with completely disabling this PAUSE capability for tests. |
Right now the suspend while paused is causing the system to hard freeze. I have no idea when this regression happened, but it shows the extent to testing and use of pause/resume. Sure, this is a corner case, but I have a faint recollection that it worked.
Yes, everything is a possibility, true.
Initially I wanted to have opt-out for pause/resume but #5035 shows that this feature has not been tested by CI and users to gave any confidence that it is working. |
91a1557
to
c6e6b47
Compare
Changes since v1:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, let's make sure CI is ready before merging this, otherwise we're going to get a slew of errors across the board.
c6e6b47
to
bb8730d
Compare
Changes since v2:
|
sound/soc/sof/intel/hda-pcm.c
Outdated
@@ -240,6 +245,14 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev, | |||
if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE) | |||
runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE; | |||
|
|||
/* | |||
* Follow the hint (unless a module parameter is set to ignore it) and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this called a "hint" when it's always followed? Because older kernel versions ignore it?
This could/should be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag is documented in previous patch as 'hint' as the flag is defaulting to false for all platforms, it is only handled by Intel code and older topologies will have PAUSE disabled also.
This is intentional decision, but I rather call it as a hint in SOF context than a hard rule, I don't expect NXP/AMD/Mediatek to disable PAUSE support, but they can if they also set to follow this hint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I should have spent more time reading the commit message. A commit message is not a substitute for documentation though, is there or will there be any? Somewhere in ALSA user space maybe?
A "hint" is indeed something that may or may not have an effect depending on other factors. However this particular "hint" will be 100% deterministic on every device! It will be 100% effective on some devices and 100% ignored on other devices. It is a "hint" only from the perspective of the developer (=you) looking at all devices at once. But it is not a hint from the perspective of any final user. I don't think this should be called a "hint", it's not necessary and quite misleading. It's just a parameter that is not supported in every configuration. Ignoring some (e.g. incompatible) parameter in some configurations is not so unusual and not called a "hint".
I don't expect NXP/AMD/Mediatek to disable PAUSE support, but they can if they also set to follow this hint.
What would be great is to print a warning in all configurations where the parameter is set and ignored, is that possible? Silently ignoring user input is extremely time consuming.
bb8730d
to
e5e16f5
Compare
Changes since v3:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of corrections needed @ujfalusi but no objections on the directions.
sound/soc/sof/sof-audio.h
Outdated
@@ -332,6 +332,14 @@ struct snd_sof_pcm_stream { | |||
struct work_struct period_elapsed_work; | |||
struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */ | |||
bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */ | |||
/* | |||
* Flag for the core and platform code about PCM pause/resume support. | |||
* Note: ENd-users are using audio via media servers (Pulseaudio, Pipewire, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray capital letter: End-users
sound/soc/sof/sof-audio.h
Outdated
* Flag for the core and platform code about PCM pause/resume support. | ||
* Note: ENd-users are using audio via media servers (Pulseaudio, Pipewire, | ||
* CRAS, etc) and media servers do not use pause/resume. | ||
* Media players using the ALSA directly have means to handle PCM devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the ALSA API directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or 'using ALSA directly' ?
e5e16f5
to
783785a
Compare
@marc-hb, something is not quite right in the expect script in case-lib/apause.exp, not sure what to be honest. It is pretty interesting what aplay/arecord does.
Pause is not supported
But it certainly not printing |
@marc-hb, I think I have found a plausible reason... So the expect script is OK. |
Yes, aplay uses Generally speaking, Expect (or anything reading from a pipe) has no concept of "overwriting" or "scrolling"; only terminals do. Other programs reading from a pipe only see a stream of characters, some of them happening to be
Thanks for the investigation!
The script is unfortunately not OK because it trusts the first, unconditional (and TBH: wrong) Not sure how to fix that. Is there some sort of more convenient API to detect the lack of pause support? And then abort/skip the test immediately instead of wasting a lot of time running pointlessly and returning misleading results. I mean more convenient than this very misleading aplay output. |
I'm not sure about other ways to check runtime info flag of the PCM, but that would be ideal This might avoid confusing the script (might need to handle the not supported case and abort?): alsa-project/alsa-utils#271 |
Anyone?
Very useful but it won't help systems and people who don't update ALSA user space regularly.
Wait: it shouldn't be too hard to catch |
@ujfalusi @marc-hb I am not able to follow what the thread is about. Is our CI able to deal with this or not? The agreement was that the pause support would be forced on all CI devices, so what is the issue? We don't really care about the case where the pause is NOT supported, because it's not really our problem is it? What I don't get is whether all CI devices are ready for this PR to be merged, adding a kernel parameter requires some changes in the setup. |
It's not our problem in theory. In practice, we still don't have consistent device configuration. |
Fail fast and avoid timeouts. This is especially important considering pause will soon be disabled by default: - thesofproject/linux#5041 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
It will be after small sof-test fix thesofproject/sof-test#1226 is merged (DONE). That fix will let us tell the difference between misconfigured devices versus well configured devices actually failing the test. @ujfalusi please review. |
Fail fast and avoid timeouts. This is especially important considering pause will soon be disabled by default: - thesofproject/linux#5041 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
SOFCI TEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ujfalusi can you rewrite the commit message. Thanks.
783785a
to
7c2318b
Compare
New tokens are added to topology: 1202: SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED 1203: SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED The new tokens are used to advertise support for PAUSE/RESUME operation on a PCM device depending on firmware product, use case, pipeline topology. The snd_sof_pcm_stream.pause_supported is updated to reflect the advertised value for the PCM device. If the token does not exist then the pause_supported is set to false. Note: it is up to the platform code to use this flag to decide to advertise the PAUSE support for user space or not. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…USE support If the stream's pause_supported flag is false then mask out the PAUSE support, so user space will be prevented to use it. Introduce a module parameter to ignore the pause_supported flag, named as force_pause_support to allow testing of the PAUSE feature. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Changes since v3:
|
@ujfalusi I have added below flag in all CI devices @ssavati, I have changed the parameter from bool to int, so it should be Sorry, it was a result of a popular vote: |
SOFCI TEST |
SOFCI TEST |
0691969
into
thesofproject:topic/sof-dev
Hi,
new token set is added by thesofproject/sof#9202 to indicate that the pause operation is supported or not on the given PCM device.
Pause is an optional feature that depends on pipeline, topology and modules running within that pipeline. Lets have a marker to help userspace and kernel know which pipelines should advertise pause.
Use this information in hda-pcm.c to disable the pause support or keep it enabled.