Skip to content

PM: refine algorithm of dai link resuming - #509

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
RanderWang:pm_fix
Jan 15, 2019
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
RanderWang:pm_fix

Conversation

@RanderWang

@RanderWang RanderWang commented Jan 7, 2019 •

Copy link
Copy Markdown

Add direction check in sof_set_dai_config because dai config
is different between playback and capture on HDA platform now,
so dai config would be saved by name and direction

this fixs #442

@RanderWang
RanderWang requested review from plbossart and ranj063 and removed request for plbossart January 7, 2019 08:48

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RanderWang. This looks much better than the previous versions but can be improved further (also the commit message isn't very clear)

Comment thread sound/soc/sof/pm.c Outdated
Comment thread sound/soc/sof/pm.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is just to keep track of the fact that the DAI was configured already, right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will add a comment for it

Comment thread sound/soc/sof/pm.c Outdated
Comment thread sound/soc/sof/topology.c Outdated
Comment thread sound/soc/sof/pm.c Outdated

@ranj063 ranj063 Jan 8, 2019 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang i'm a bit confused by this logic because there are 3 types of dai's, each with indices ranging from 0 - max_of_each_type. But you use only one array of 0-max. So depending on which order the dai's were added, you could miss out on configuring some dai's. please correct me if i am wrong.

Also, we dont really have any issues because of sending the dai config twice for the same dai. Is it really important to avoid the second IPC if it does no harm?

@RanderWang RanderWang Jan 8, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang i'm a bit confused by this logic because there are 3 types of dai's, each with indices ranging from 0 - max_of_each_type. But you use only one array of 0-max. So depending on which order the dai's were added, you could miss out on configuring some dai's. please correct me if i am wrong.

yes, there maybe 3 types of dais but not each indices ranging from 0 - max. All of them are in the range of 0 - max

Also, we dont really have any issues because of sending the dai config twice for the same dai. Is it really important to avoid the second IPC if it does no harm?

no, we have a issue. If one dai config is set two times, one DMA channel would be wasted in FW. please refer to thesofproject/sof#786

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang thanks for confirming that this is required.

But about my first comment, so can different types of DAI's not have the same dai index?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at sof-apl-nocodec.m4 , i feel like the assumption that the dai index for all DAI's is unique is wrong.

@RanderWang RanderWang Jan 8, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I check the file and don't find a same id. First we should make clear the usage of dai index. It is used in ASoC which doesn't care the type of dai. It just identifies dai by index.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh. if the firmware can detect the configs are the same, why couldn't the driver do it as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart thanks for your comment. It make easier for me now. And the PR in FW is ready thesofproject/sof#786

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this FW PR have to do with configs being sent twice?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dma channel is not released when config is set again. This PR would check whether dma channel is allocated for a dai link config and avoid allocating dma channel again @keyonjie

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang so are you suggesting we just send the config twice as the FW can handle it now?

@RanderWang

Copy link
Copy Markdown
Author

update my PR.
(1) remove dai link check in kernel. FW could deal with this case
(2) check the status of dai config saving, and report error in one location to make it clear

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang did you intend to proceed further if ret is < 0 here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 no, I will refine it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang the other thing Pierre suggested was to use a loop so you dont have the same code twice for playback and capture. You could try something like this:

for (dir = SNDRV_PCM_STREAM_PLAYBACK; dir <= SNDRV_PCM_STREAM_CAPTURE; dir++) {
flag = (dir == SNDRV_PCM_STREAM_PLAYBACK) ? link->dpcm_playback : link->dpcm_capture;
if (flag)
ret = sof_set_dai_config(sdev, size, link, config, dir);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to use loop for two items? I don't like it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even wondering why we can't deal with the direction inside of sof_set_dai_config since all the other arguments are identical. It'd simplify the code further.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will do it

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR changed directions multiple times, you are soon going to hit your quota of reviewer bandwidth.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am even wondering why we can't deal with the direction inside of sof_set_dai_config since all the other arguments are identical. It'd simplify the code further.

@RanderWang

Copy link
Copy Markdown
Author

Update my PR, thanks!

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @RanderWang The first patch was fine and simple-enough (only minor improvement suggested), the second one isn't what I had in mind and makes things less readable.
So either you remove the second patch or you make it nicer, your call.

Comment thread sound/soc/sof/topology.c Outdated
Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is try to pass link and config ONCE, then use it internablly in sof_set_dai_config.
Passing two arguments, once of which is NULL with additional tests is just horrible and makes the code more confusing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for HDA, two different configs need to be set by sof_set_dai_config.
If I just pass config ONCE, I need to add direction and call sof_set_dai_config two times.
The direction info is not included by link setting or config.

I will try to refine it without NULL.

Comment thread sound/soc/sof/topology.c Outdated
Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang same here use SNDRV_PCM_STREAM_PLAYBACK instead of 0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will refine it

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will refine it

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang I think this change looks rather awkward. You really only use both playback and capture configs for SSP dai links and in that case both of them are the same.

@ranj063

ranj063 commented Jan 9, 2019 •

Copy link
Copy Markdown
Collaborator

@RanderWang here's a suggestion to modify the patch. It is only compile tested. Please feel free to modify it and clean up as needed.
rander_patch.txt

@RanderWang
RanderWang force-pushed the pm_fix branch 2 times, most recently from 6fe0a05 to dd7f069 Compare January 10, 2019 09:50
@RanderWang

Copy link
Copy Markdown
Author

update my PR, thanks.

@RanderWang

Copy link
Copy Markdown
Author

@RanderWang here's a suggestion to modify the patch. It is only compile tested. Please feel free to modify it and clean up as needed.
rander_patch.txt

Thank you very much! I find another simple way to fix it.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to be patient, polite and respectful, but I am afraid this is really still quite flaky . It's a mix of basic mistakes like not testing the error status and more fundamental ones with complicated and inefficient code. i've spend several hours this week on this...

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should there be a check that there was at least one change done? Currently this function only return 0 or -ENOMEM. If there was no match we still return zero, is this intentional?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will add result check.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to test the status here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this look good at first sight, but then looking deeper the code does this

/* for hda link, playback and capture are supported by different
	 * dai in FW. Here get the dai_index of each dai and send config
	 * to FW. In FW, each dai sets config by dai_index
	 */
	list_for_each_entry(dai, &sdev->dai_list, list) {
		if (!dai->name)
			continue;

		if (strcmp(link->name, dai->name) == 0) {
			config->dai_index = dai->comp_dai.dai_index;

			if (dai->comp_dai.direction ==
			    SNDRV_PCM_STREAM_PLAYBACK)
				config->hda.link_dma_ch = tx_slot;
			else
				config->hda.link_dma_ch = rx_slot;

			ret = sof_set_dai_config(sdev, size, link,
						 config);
<<<<
static int sof_set_dai_config(struct snd_sof_dev *sdev, u32 size,
			      struct snd_soc_dai_link *link,
			      struct sof_ipc_dai_config *config)
{
	struct snd_sof_dai *dai;

	list_for_each_entry(dai, &sdev->dai_list, list) {
		if (!dai->name)
			continue;

		if (strcmp(link->name, dai->name) == 0 &&
		    dai->comp_dai.dai_index == config->dai_index) {
			dai->dai_config = kmemdup(config, size, GFP_KERNEL);
			if (!dai->dai_config)
				return -ENOMEM;
		}
	}

	return 0;
}
<<<<<

			/* send message to DSP */
			ret = sof_ipc_tx_message(sdev->ipc,
						 config->hdr.cmd, config, size,
						 &reply, sizeof(reply));

			if (ret < 0) {
				dev_err(sdev->dev, "error: failed to set DAI config for direction:%d of HDA dai %d\n",
					dai->comp_dai.direction,
					config->dai_index);

				return ret;
			}

			found = 1;
		}
	}

so you have two nested loops that look for the same data. Doesn't seem terribly efficient.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart that is a good catch. we should just kmemdup the config before sending the IPC.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I know this issue but I want to make HDA work as SSP so I call sof_set_dai_config.
Ok, I will refine it to avoid this call.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is very hard to review, you add changes to hda_process in this patch, and again changes in the next patch. I had to go directly to the code to figure out what the result is. Please don't do this, it's a waste of time for reviewers.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch is to simplify HDA processing, and another patch is to fix dai saving. I want to make reviewer understand it step by step, not all in one patch. I could merge them together.

@RanderWang

Copy link
Copy Markdown
Author

Thanks for your patient. It is all caused by ugly design of HDA. It is a challenge to build beautiful code based on ugly base. Next let us refine our HDA code as SSP , then we don't have to struggle with divergence.

@RanderWang
RanderWang force-pushed the pm_fix branch 3 times, most recently from 3b6e30e to b891340 Compare January 11, 2019 05:07
@RanderWang

Copy link
Copy Markdown
Author

update PR, thanks!

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang minor comment. shouldnt this be "failed to find dai" and not dai link

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang This looks a lot cleaner but if tx_slot and rx_slot are both non-zero, you need to make sure both are set right? But here, you only check if one is found.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, both are set if non-zero. I get your idea

@RanderWang
RanderWang force-pushed the pm_fix branch 2 times, most recently from 0d91882 to 6fd38b4 Compare January 11, 2019 09:54
@plbossart

plbossart commented Jan 11, 2019 via email

Copy link
Copy Markdown
Member

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang hopefully this will be the last issue. Apart from checking the direction, you also need to check if tx_slot is non-zero to proceed here. Similarly for capture.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 I have thought about this. There is no need here
(1) if there is a playback dai then tx_slot should be correct, please see sof_link_hda_load.
tx_slot would be queried if this dai link support playback. So I don't want to check it again.

(2) tx_slot could be zero and this means dma channel zero is used for hda.

@ranj063 ranj063 Jan 14, 2019 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 I have thought about this. There is no need here
(1) if there is a playback dai then tx_slot should be correct, please see sof_link_hda_load.
tx_slot would be queried if this dai link support playback. So I don't want to check it again.

(2) tx_slot could be zero and this means dma channel zero is used for hda.

@RanderWang sorry what does it mean by "dma channel zero is used for hda"?
Also what about the capture case, if rx_slot is zero, you should be doing nothing but with this change you'd still send an ipc, isnt it?

@ranj063 ranj063 Jan 14, 2019 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang i think I get your point. Basically if rx_slot is zero, the expectation is there we will not be able to find dai with the same dai_link with a capture direction. Is that your argument?

@RanderWang RanderWang Jan 14, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 I just took playback for example. Capture is the same as playback. tx_slot and rx_slot
could be zero. They could be only sent if this dai link supports them

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 But I still don't get why we would remove playback and capture on SSP2 and still have just the dai_config for SSP2 BE dai link.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang the point is you could have just playback or just capture on SSP2.

@RanderWang RanderWang Jan 14, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you idea is: playback or capture are defined in machine driver, but our topology could support it or not. I discuss with Keyon, and we agree with you at this point. Our idea is: machine driver could define two dai, but topology should support at least one dai. So the error check in sof_set_dai_config is correct. It only check whether at least one dai exist. And in hda function, only check one of playback or capture exsit. The code should be the same as sof_set_dai_config. What is your idea? thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang @keyonjie I think there's no need to check even if one dai is set. The machine driver could define SSP2 but what if I do not want to use SSP2 at all for playback/capture?Logically, in that case i'd probably remove the dai_config for SSP2 but I could just leave it as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 if you do not want to use SSP2 at all , why this dai link is set in topology file? If it is not in topology file, these function could not be called.

@RanderWang
RanderWang requested a review from keyonjie January 14, 2019 05:24
Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang as we discussed, let's change this to be:

if ((link->dpcm_playback && playback_found) ||
    (link->dpcm_capture && capture_found)) {
        dev_info(...);//success
} else {
        dev_err();// error.
        return -EINVAL;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang @keyonjie should it be a warning instead of error. My point is that nothing would be broken in this case. Its just that we will not have a pcm that uses the BE with this config in this case.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ranj063 yes, I get your idea and I am refining it now

@RanderWang
RanderWang force-pushed the pm_fix branch 2 times, most recently from b71a17b to 4ac1c44 Compare January 14, 2019 07:21
@RanderWang

RanderWang commented Jan 14, 2019 •

Copy link
Copy Markdown
Author

update my PR, after discussing with Ranjani and keyon, I do these change.
Machine driver may define dai link with playback and capture enabled, but the dai
link in topology would support both, one or none of them. So a warning would be reported
here if no dai found

Thanks for review!

@RanderWang
RanderWang force-pushed the pm_fix branch 4 times, most recently from a20fe4a to 943bae5 Compare January 14, 2019 08:34
@keyonjie

Copy link
Copy Markdown

LGTM.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a very suspicious test that makes me think the code isn't quite right.
Also error handling on found=0 isn't clear (add a comment or fix) and couple of comment style issues.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really be returning 0 in that case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will add a comment for it. I discussed with @ranj063 that dai may not be supported by topology although the dai link is defined in machine driver, so none of dai would be found. But we should print a warning to notify user: is this really you want?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart the rationale for returning a 0 is that even if we dont find a dai to set the config for, there will really be no negative consequences of having just a BE dai config without a pipeline that uses it.
Of course, logically it probably makes no sense. Thats why the warning here.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ret is not set before testing it at each iteration, what are you trying to check here?
This looks like a mistake.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very sorry to have this error. I will remove it. I change my code according to reviewer's comment, but here I missed to delete it.

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix block comment style, should be

/*
* machine
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will

Comment thread sound/soc/sof/topology.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix block comment style

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will

Move the code for playback and capture into sof_link_hda_process.
This make code simpler and do configuration in one loop

Check status in functions for dai link config saving. Machine driver
may define dai link with playback and capture enabled, but the dai
link in topology would support both, one or none of them. So a warning
would be reported here.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
@RanderWang

Copy link
Copy Markdown
Author

update my PR
(1) fix style issue
(2) fix error checking issue
(3) add comment to explain found check

Test in on WHL. Thanks for review!

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok let's merge. 97 comments is officially a record.

@plbossart
plbossart merged commit eec37ea into thesofproject:topic/sof-dev Jan 15, 2019
@wenqingfu

Copy link
Copy Markdown

if it's not 'fixs' in the header, #442 will be closed after the merge :)

@RanderWang

Copy link
Copy Markdown
Author

if it's not 'fixs' in the header, #442 will be closed after the merge :)

copy & paste error......

@RanderWang

Copy link
Copy Markdown
Author

“fixs #422”字样必须出现在submit PR的那个初始帖子或者commit message里, 否则也是无效的.
copy homework with error included

@wenqingfu

Copy link
Copy Markdown

🤦‍♂️

oder-chiou pushed a commit to oder-chiou/linux-soundwire that referenced this pull request May 5, 2026
The thermal driver [0] for Renesas RZ/G2L SoC does not implement
set_trip_temp() callback but has trips commit 9326167
("thermal/core: Move set_trip_temp ops to the sysfs code") changed
the behaviour which causes the below panic when trying to set the
trip temperature:

root@smarc-rzg2l:~# echo 51000 > /sys/class/thermal/thermal_zone0/trip_point_0_temp
[   92.461521] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   92.470958] Mem abort info:
[   92.474311]   ESR = 0x0000000086000004
[   92.478546]   EC = 0x21: IABT (current EL), IL = 32 bits
[   92.484290]   SET = 0, FnV = 0
[   92.487693]   EA = 0, S1PTW = 0
[   92.491153]   FSC = 0x04: level 0 translation fault
[   92.496461] user pgtable: 4k pages, 48-bit VAs, pgdp=000000004e885000
[   92.503736] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[   92.510869] Internal error: Oops: 86000004 [thesofproject#3] PREEMPT SMP
[   92.516556] CPU: 0 PID: 290 Comm: sh Tainted: G      D            6.0.0-rc4-next-20220906-arm64-renesas-00124-g84633c87c5f6-dirty thesofproject#509
[   92.528814] Hardware name: Renesas SMARC EVK based on r9a07g044l2 (DT)
[   92.535441] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   92.542516] pc : 0x0
[   92.544764] lr : trip_point_temp_store+0x84/0x140
[   92.549582] sp : ffff80000a92bc10
[   92.552961] x29: ffff80000a92bc10 x28: ffff00000d8a45c0 x27: 0000000000000000
[   92.560249] x26: 0000000000000000 x25: ffff8000082b53e8 x24: ffff00000eaffc20
[   92.567532] x23: ffff80000a92bd68 x22: ffff00000d3e0f80 x21: 0000000000000006
[   92.574814] x20: ffff800009149000 x19: ffff00000b8ab000 x18: 0000000000000000
[   92.582097] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab028cdee0
[   92.589378] x14: 0000000000000000 x13: 0000000000000000 x12: ffff80000a92bbd0
[   92.596659] x11: ffff00000d3e0f80 x10: ffff800009149eb8 x9 : 000000000000000a
[   92.603940] x8 : 00000000ffffffc9 x7 : 0000000000000005 x6 : 000000000000002a
[   92.611220] x5 : 000000000000c738 x4 : 00000000ffffffd3 x3 : 0000000000000000
[   92.618500] x2 : 000000000000c738 x1 : 0000000000000000 x0 : ffff00000b8ab000
[   92.625781] Call trace:
[   92.628282]  0x0
[   92.630176]  dev_attr_store+0x14/0x28
[   92.633935]  sysfs_kf_write+0x4c/0x70
[   92.637681]  kernfs_fop_write_iter+0x160/0x1e0
[   92.642213]  vfs_write+0x474/0x540
[   92.645703]  ksys_write+0x68/0xf8
[   92.649100]  __arm64_sys_write+0x18/0x20
[   92.653111]  invoke_syscall+0x40/0xf8
[   92.656866]  el0_svc_common.constprop.3+0x88/0x110
[   92.661758]  do_el0_svc+0x20/0x78
[   92.665158]  el0_svc+0x3c/0x90
[   92.668291]  el0t_64_sync_handler+0x90/0xb8
[   92.672563]  el0t_64_sync+0x148/0x14c
[   92.676322] Code: bad PC value
[   92.679453] ---[ end trace 0000000000000000 ]---
/bin/start_getty: line 40:   290 Segmentation fault      ${setsid:-} ${getty} -L $1 $2 $3

Poky (Yocto Project Reference Distro) 3.2.1 smarc-rzg2l ttySC0

smarc-rzg2l login:

This patch fixes the above issue by adding a check to see if
set_trip_temp() callback is implemented before calling it.

[0] drivers/thermal/rzg2l_thermal.c

Fixes: 9326167 ("thermal/core: Move set_trip_temp ops to the sysfs code")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20220908174610.7837-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
oder-chiou pushed a commit to oder-chiou/linux-soundwire that referenced this pull request May 5, 2026
With 64K page on arm64, verifier_arena_globals1 failed like below:
  ...
  libbpf: map 'arena': failed to create: -E2BIG
  ...
  thesofproject#509/1   verifier_arena_globals1/check_reserve1:FAIL
  ...

For 64K page, if the number of arena pages is (1UL << 20), the total
memory will exceed 4G and this will cause map creation failure.
Adjusting ARENA_PAGES based on the actual page size fixed the problem.

Cc: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260113061033.3798549-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
naveen-manohar pushed a commit to naveen-manohar/linux that referenced this pull request Aug 13, 2026
The thermal driver [0] for Renesas RZ/G2L SoC does not implement
set_trip_temp() callback but has trips commit 9326167
("thermal/core: Move set_trip_temp ops to the sysfs code") changed
the behaviour which causes the below panic when trying to set the
trip temperature:

root@smarc-rzg2l:~# echo 51000 > /sys/class/thermal/thermal_zone0/trip_point_0_temp
[   92.461521] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   92.470958] Mem abort info:
[   92.474311]   ESR = 0x0000000086000004
[   92.478546]   EC = 0x21: IABT (current EL), IL = 32 bits
[   92.484290]   SET = 0, FnV = 0
[   92.487693]   EA = 0, S1PTW = 0
[   92.491153]   FSC = 0x04: level 0 translation fault
[   92.496461] user pgtable: 4k pages, 48-bit VAs, pgdp=000000004e885000
[   92.503736] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[   92.510869] Internal error: Oops: 86000004 [thesofproject#3] PREEMPT SMP
[   92.516556] CPU: 0 PID: 290 Comm: sh Tainted: G      D            6.0.0-rc4-next-20220906-arm64-renesas-00124-g84633c87c5f6-dirty thesofproject#509
[   92.528814] Hardware name: Renesas SMARC EVK based on r9a07g044l2 (DT)
[   92.535441] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   92.542516] pc : 0x0
[   92.544764] lr : trip_point_temp_store+0x84/0x140
[   92.549582] sp : ffff80000a92bc10
[   92.552961] x29: ffff80000a92bc10 x28: ffff00000d8a45c0 x27: 0000000000000000
[   92.560249] x26: 0000000000000000 x25: ffff8000082b53e8 x24: ffff00000eaffc20
[   92.567532] x23: ffff80000a92bd68 x22: ffff00000d3e0f80 x21: 0000000000000006
[   92.574814] x20: ffff800009149000 x19: ffff00000b8ab000 x18: 0000000000000000
[   92.582097] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab028cdee0
[   92.589378] x14: 0000000000000000 x13: 0000000000000000 x12: ffff80000a92bbd0
[   92.596659] x11: ffff00000d3e0f80 x10: ffff800009149eb8 x9 : 000000000000000a
[   92.603940] x8 : 00000000ffffffc9 x7 : 0000000000000005 x6 : 000000000000002a
[   92.611220] x5 : 000000000000c738 x4 : 00000000ffffffd3 x3 : 0000000000000000
[   92.618500] x2 : 000000000000c738 x1 : 0000000000000000 x0 : ffff00000b8ab000
[   92.625781] Call trace:
[   92.628282]  0x0
[   92.630176]  dev_attr_store+0x14/0x28
[   92.633935]  sysfs_kf_write+0x4c/0x70
[   92.637681]  kernfs_fop_write_iter+0x160/0x1e0
[   92.642213]  vfs_write+0x474/0x540
[   92.645703]  ksys_write+0x68/0xf8
[   92.649100]  __arm64_sys_write+0x18/0x20
[   92.653111]  invoke_syscall+0x40/0xf8
[   92.656866]  el0_svc_common.constprop.3+0x88/0x110
[   92.661758]  do_el0_svc+0x20/0x78
[   92.665158]  el0_svc+0x3c/0x90
[   92.668291]  el0t_64_sync_handler+0x90/0xb8
[   92.672563]  el0t_64_sync+0x148/0x14c
[   92.676322] Code: bad PC value
[   92.679453] ---[ end trace 0000000000000000 ]---
/bin/start_getty: line 40:   290 Segmentation fault      ${setsid:-} ${getty} -L $1 $2 $3

Poky (Yocto Project Reference Distro) 3.2.1 smarc-rzg2l ttySC0

smarc-rzg2l login:

This patch fixes the above issue by adding a check to see if
set_trip_temp() callback is implemented before calling it.

[0] drivers/thermal/rzg2l_thermal.c

Bug: 251537418
Fixes: 9326167 ("thermal/core: Move set_trip_temp ops to the sysfs code")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: I50656add5bf3971c3b53d027b835de47e1e88e49
(cherry picked from commit 64b269c)
ujfalusi pushed a commit to ujfalusi/sof-linux that referenced this pull request Oct 7, 2026
Add a test which builds an ICMP error out of a TCP segment. A tcx prog
on the client's egress side trims the first data segment down to the
target size and pushes the ICMP error headers in front of it to then
reflect the packet back to the sender.

  # LDLIBS=-static PKG_CONFIG='pkg-config --static' ./vmtest.sh -- ./test_progs -t tc_change_tail
  [...]
  thesofproject#509     tc_change_tail:OK
  thesofproject#510     tc_change_tail_pmtu:OK
  Summary: 2/0 PASSED, 0 SKIPPED, 0/0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20260907121025.1923656-2-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants