Repository navigation
Conversation
plbossart
left a comment
There was a problem hiding this comment.
not fully understanding the problem and the fix?
| fwnode->secondary = ERR_PTR(-ENODEV); | ||
|
|
||
| if (fwnode_is_primary(dev->fwnode)) | ||
| if (dev->fwnode) |
There was a problem hiding this comment.
The change may be right, but I don't see how this fixes the timeouts and what the relationship is between pm_runtime issues and device properties?
Also your commit message is hard to follow, can you revisit the wording and explain the sequence that leads to the problem better?
There was a problem hiding this comment.
It's also not clear to me why this change is only required after @andy-shev changes - Really lost on how Andy's changes introduced the resume timeouts we are seeing and how this patches corrects the behavior.
|
I guess here is a misunderstanding what primary and secondary means. I tried to describe this in the andy-shev@d5dcce0. Also there may be different cases: primary and secondary are coupled, or they are independent and they (each of them) may be exclusive or shared (in this commit andy-shev@99aed92 i explained case when primary is shared and what is the outcome of breaking the link). Note, primary node is configured by OF or ACPI and by individual drivers by sharing it among devices. Cleaning happens only when device is gone (by device core). Can we see better explanation what's the problem is? |
|
Okay, we have these cases:
Last one is easy. First one goes like this. Second one is relatively easy. Third one is simply check if it's secondary and assign NULL directly to |
And the last is not correct. If you assign secondary without primary, something is not okay. I guess what you are trying to do is actually to have
follwed by |
|
@andy-shev for more context, see #2603 (comment). What we identified later is that the timeouts happens if we first have a sequence of modprobe/rmmod and remove/re-add devices. We bisected these timeouts to the introduction of timeouts to the two patches you added in v5.10-rc2. Reverting the 2 patches solves the timeout issue. Here in this PR @bardliao was trying to see if there was a problem with properties, but I am with you, I don't get what the suggested fixes do nor why they would impact SoundWire suspend-resume. The one point I do get is we share the same fwnode between two layers so there's isn't a zero correlation with your changes. |
|
@plbossart Can you do a quick test if replacing -ENODEV to NULL in that assignment ( |
Sorry, not following @andy-shev. The rest of the code uses IS_ERR, except where it doesn't... e.g. static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
{
return fwnode && !IS_ERR(fwnode->secondary);
}
void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
{
if (fwnode)
fwnode->secondary = ERR_PTR(-ENODEV);
static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode,
const char *propname,
unsigned int elem_size, void *val,
size_t nval)
{
int ret;
ret = fwnode_call_int_op(fwnode, property_read_int_array, propname,
elem_size, val, nval);
if (ret == -EINVAL && !IS_ERR_OR_NULL(fwnode) &&
!IS_ERR_OR_NULL(fwnode->secondary))
...
struct fwnode_handle *device_get_next_child_node(struct device *dev,
/* When no more children in primary, continue with secondary */
if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary)) |
|
Reverting only this (it needs to be done manually because of another patch) andy-shev@d5dcce0. I believe if it helps the problem is exactly what I described: an attempt to assign a secondary node to device which already has one. |
|
Thanks @andy-shev for the explanation.
Yes, it helps.
You are right. But the |
ACPI doesn't set secondary. Something is way wrong in your case if it's true. Custom patches?
I'm sorry I barely understand what is going on in this log. The rule of thumb is when you provide a trace, provide a code which gives that trace to understand where it's exactly taken and what is the mean of the fields in output. |
|
@andy-shev @bardliao I added a trace of what I think goes South, see plbossart@76d0f5a I think when we unload a driver and call set_primary_fwnode(NULL), the fwnode remains secondary (set to ERR_PTR(-NODEV)), so the next time we probe and add properties we end-up overriding the fwnode with the properties. There's something missing in the initialization, either in the device core or the SoundWire core, so that on probe the previous fwnode->secondary has to become NULL again. |
9f748a7 to
fdbfb97
Compare
fdbfb97 to
2a0f59e
Compare
When we call set_primary_fwnode(dev, NULL) to remove a primary->NULL fwnode, "fn->secondary = ERR_PTR(-ENODEV);" will force primary->NULL become primary->ERR_PTR(-ENODEV) which is not what we expected. This patch doesn't impact removing primary->secondary->ERR_PTR(-ENODEV) fwnode. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
2a0f59e to
7c80a6b
Compare
|
@andy-shev @plbossart If we use The updated commit suggested a fix. Does it make sense? |
The above makes no sense. I think you didn't get how it supposed to work. When you call
No. As I told there is a mix of terminology and position in the list.
All other combinations are illegal! |
I will put here your words from above link:
Hooray! Now you understand the issue with UPDATE
|
@andy-shev Yes, dmesg.txt
Yes, this PR is exactly trying to avoid the unexpected * primary --> -ENODEV
|
@andy-shev we do remove the properties when appropriate without relying on the device core. we did this a while ago. Even if we used swnodes directly, the problem would still exist: The problem is that when doing an rmmod snd-soc-rt711, ACPI_COMPANION_SET is called with a NULL parameter, so the fwnode is tagged as secondary. Then when we redo a modprobe snd-sof-rt711 and later add properties, the fwnode is not considered as primary, so the dev->fwnode will be overridden by the properties. In other words, we get a different result during the second iteration of our kmod load/unload tests. I think it's keeping the type of the fwnode that is problematic when dealing with probe/remove. That's what @bardliao suggested forcing the fwnode->secondary= NULL to force the fwnode back to a primary when registering a device. |
So, from the state of
Right.
Okay, but do you agree that this is not the best approach? |
…re node pointer
If we do the following sequence of calls
The secondary will be set to ERR_PTR(-ENODEV) in set_primary_fwnode(),
and it will not pass the fwnode_is_primary() test of call
set_secondary_fwnode(dev, secondary node);
The idea is that if (dev->fwnode) is not NULL, it must be primary no
matter what secondary is.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com