* [PATCH 0/1] media: uvcvideo: Support devices that report an OT as an entity source @ 2021-03-08 10:31 Hans de Goede 2021-03-08 10:31 ` [PATCH 1/1] " Hans de Goede 0 siblings, 1 reply; 5+ messages in thread From: Hans de Goede @ 2021-03-08 10:31 UTC (permalink / raw) To: Laurent Pinchart, Hans Verkuil, Mauro Carvalho Chehab Cc: Hans de Goede, linux-media Hi Mauro, et al., Fedora has been receiving quite a lot of bug reports (about 1 per day) for a while now about the WARN_ON recently added by the: "media: mc-entity.c: use WARN_ON, validate link pads" commit triggering with uvcvideo (causing backtraces in dmesg). I've been acting as a go-between for the Fedora bug reporters and Laurent. Laurent has written the fix which I'm posting here; I've provided a Fedora kernel to the users with the fix added and they have confirmed that this fixes the WARN_ON triggering. Since Laurent is a bit short on time ATM I'm submitting his patch upstream now that it has been tested. Regards, Hans Laurent Pinchart (1): media: uvcvideo: Support devices that report an OT as an entity source drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 2.30.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] media: uvcvideo: Support devices that report an OT as an entity source 2021-03-08 10:31 [PATCH 0/1] media: uvcvideo: Support devices that report an OT as an entity source Hans de Goede @ 2021-03-08 10:31 ` Hans de Goede 2021-03-31 10:38 ` Hans de Goede 0 siblings, 1 reply; 5+ messages in thread From: Hans de Goede @ 2021-03-08 10:31 UTC (permalink / raw) To: Laurent Pinchart, Hans Verkuil, Mauro Carvalho Chehab Cc: Hans de Goede, linux-media, John Nealy From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Some devices reference an output terminal as the source of extension units. This is incorrect, as output terminals only have an input pin, and thus can't be connected to any entity in the forward direction. The resulting topology would cause issues when registering the media controller graph. To avoid this problem, connect the extension unit to the source of the output terminal instead. While at it, and while no device has been reported to be affected by this issue, also handle forward scans where two output terminals would be connected together, and skip the terminals found through such an invalid connection. Reported-and-tested-by: John Nealy <jnealy3@yahoo.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 30ef2a3110f7..8df58f04dac6 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, return -EINVAL; } + /* + * Some devices reference an output terminal as the + * source of extension units. This is incorrect, as + * output terminals only have an input pin, and thus + * can't be connected to any entity in the forward + * direction. The resulting topology would cause issues + * when registering the media controller graph. To + * avoid this problem, connect the extension unit to + * the source of the output terminal instead. + */ + if (UVC_ENTITY_IS_OTERM(entity)) { + struct uvc_entity *source; + + source = uvc_entity_by_id(chain->dev, + entity->baSourceID[0]); + if (!source) { + uvc_dbg(chain->dev, DESCR, + "Can't connect extension unit %u in chain\n", + forward->id); + break; + } + + forward->baSourceID[0] = source->id; + } + list_add_tail(&forward->chain, &chain->entities); if (!found) uvc_dbg_cont(PROBE, " (->"); @@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, return -EINVAL; } + if (UVC_ENTITY_IS_OTERM(entity)) { + uvc_dbg(chain->dev, DESCR, + "Unsupported connection between output terminals %u and %u\n", + entity->id, forward->id); + break; + } + list_add_tail(&forward->chain, &chain->entities); if (!found) uvc_dbg_cont(PROBE, " (->"); -- 2.30.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] media: uvcvideo: Support devices that report an OT as an entity source 2021-03-08 10:31 ` [PATCH 1/1] " Hans de Goede @ 2021-03-31 10:38 ` Hans de Goede 2021-03-31 11:03 ` Laurent Pinchart 0 siblings, 1 reply; 5+ messages in thread From: Hans de Goede @ 2021-03-31 10:38 UTC (permalink / raw) To: Laurent Pinchart, Hans Verkuil, Mauro Carvalho Chehab Cc: linux-media, John Nealy Hi All, On 3/8/21 11:31 AM, Hans de Goede wrote: > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Some devices reference an output terminal as the source of extension > units. This is incorrect, as output terminals only have an input pin, > and thus can't be connected to any entity in the forward direction. The > resulting topology would cause issues when registering the media > controller graph. To avoid this problem, connect the extension unit to > the source of the output terminal instead. > > While at it, and while no device has been reported to be affected by > this issue, also handle forward scans where two output terminals would > be connected together, and skip the terminals found through such an > invalid connection. > > Reported-and-tested-by: John Nealy <jnealy3@yahoo.com> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Hans de Goede <hdegoede@redhat.com> Ping? This is a bug-fix which fixes a WARN triggering, causing many users to see a backtrace in their kernel-logs and reporting bugs about this: https://bugzilla.redhat.com/buglist.cgi?quicksearch=mc-entity.c Currently shows 12 open bugs for this and this is not counting all the ones which have already been triaged and matched as dups. As such it would be really good if we can get this merged and on its way to 5.12-rc# as a fix for 5.12 (and to be backported to the stable series). Regards, Hans > --- > drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c > index 30ef2a3110f7..8df58f04dac6 100644 > --- a/drivers/media/usb/uvc/uvc_driver.c > +++ b/drivers/media/usb/uvc/uvc_driver.c > @@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, > return -EINVAL; > } > > + /* > + * Some devices reference an output terminal as the > + * source of extension units. This is incorrect, as > + * output terminals only have an input pin, and thus > + * can't be connected to any entity in the forward > + * direction. The resulting topology would cause issues > + * when registering the media controller graph. To > + * avoid this problem, connect the extension unit to > + * the source of the output terminal instead. > + */ > + if (UVC_ENTITY_IS_OTERM(entity)) { > + struct uvc_entity *source; > + > + source = uvc_entity_by_id(chain->dev, > + entity->baSourceID[0]); > + if (!source) { > + uvc_dbg(chain->dev, DESCR, > + "Can't connect extension unit %u in chain\n", > + forward->id); > + break; > + } > + > + forward->baSourceID[0] = source->id; > + } > + > list_add_tail(&forward->chain, &chain->entities); > if (!found) > uvc_dbg_cont(PROBE, " (->"); > @@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, > return -EINVAL; > } > > + if (UVC_ENTITY_IS_OTERM(entity)) { > + uvc_dbg(chain->dev, DESCR, > + "Unsupported connection between output terminals %u and %u\n", > + entity->id, forward->id); > + break; > + } > + > list_add_tail(&forward->chain, &chain->entities); > if (!found) > uvc_dbg_cont(PROBE, " (->"); > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] media: uvcvideo: Support devices that report an OT as an entity source 2021-03-31 10:38 ` Hans de Goede @ 2021-03-31 11:03 ` Laurent Pinchart 2021-03-31 11:37 ` Hans de Goede 0 siblings, 1 reply; 5+ messages in thread From: Laurent Pinchart @ 2021-03-31 11:03 UTC (permalink / raw) To: Hans de Goede Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, John Nealy Hi Hans, On Wed, Mar 31, 2021 at 12:38:07PM +0200, Hans de Goede wrote: > On 3/8/21 11:31 AM, Hans de Goede wrote: > > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > Some devices reference an output terminal as the source of extension > > units. This is incorrect, as output terminals only have an input pin, > > and thus can't be connected to any entity in the forward direction. The > > resulting topology would cause issues when registering the media > > controller graph. To avoid this problem, connect the extension unit to > > the source of the output terminal instead. > > > > While at it, and while no device has been reported to be affected by > > this issue, also handle forward scans where two output terminals would > > be connected together, and skip the terminals found through such an > > invalid connection. > > > > Reported-and-tested-by: John Nealy <jnealy3@yahoo.com> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > > Ping? This is a bug-fix which fixes a WARN triggering, causing many > users to see a backtrace in their kernel-logs and reporting bugs about this: > > https://bugzilla.redhat.com/buglist.cgi?quicksearch=mc-entity.c > > Currently shows 12 open bugs for this and this is not counting all the > ones which have already been triaged and matched as dups. > > As such it would be really good if we can get this merged and on > its way to 5.12-rc# as a fix for 5.12 (and to be backported to the > stable series). The patch is included in "[GIT PULL FOR v5.13] Miscellaneous changes". I have no personal issue with it being merged in v5.12-rc, but technically it's not a regression fix, is it ? I'll let Mauro decide what works best for him. > > --- > > drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++++ > > 1 file changed, 32 insertions(+) > > > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c > > index 30ef2a3110f7..8df58f04dac6 100644 > > --- a/drivers/media/usb/uvc/uvc_driver.c > > +++ b/drivers/media/usb/uvc/uvc_driver.c > > @@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, > > return -EINVAL; > > } > > > > + /* > > + * Some devices reference an output terminal as the > > + * source of extension units. This is incorrect, as > > + * output terminals only have an input pin, and thus > > + * can't be connected to any entity in the forward > > + * direction. The resulting topology would cause issues > > + * when registering the media controller graph. To > > + * avoid this problem, connect the extension unit to > > + * the source of the output terminal instead. > > + */ > > + if (UVC_ENTITY_IS_OTERM(entity)) { > > + struct uvc_entity *source; > > + > > + source = uvc_entity_by_id(chain->dev, > > + entity->baSourceID[0]); > > + if (!source) { > > + uvc_dbg(chain->dev, DESCR, > > + "Can't connect extension unit %u in chain\n", > > + forward->id); > > + break; > > + } > > + > > + forward->baSourceID[0] = source->id; > > + } > > + > > list_add_tail(&forward->chain, &chain->entities); > > if (!found) > > uvc_dbg_cont(PROBE, " (->"); > > @@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, > > return -EINVAL; > > } > > > > + if (UVC_ENTITY_IS_OTERM(entity)) { > > + uvc_dbg(chain->dev, DESCR, > > + "Unsupported connection between output terminals %u and %u\n", > > + entity->id, forward->id); > > + break; > > + } > > + > > list_add_tail(&forward->chain, &chain->entities); > > if (!found) > > uvc_dbg_cont(PROBE, " (->"); -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] media: uvcvideo: Support devices that report an OT as an entity source 2021-03-31 11:03 ` Laurent Pinchart @ 2021-03-31 11:37 ` Hans de Goede 0 siblings, 0 replies; 5+ messages in thread From: Hans de Goede @ 2021-03-31 11:37 UTC (permalink / raw) To: Laurent Pinchart Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, John Nealy Hi, On 3/31/21 1:03 PM, Laurent Pinchart wrote: > Hi Hans, > > On Wed, Mar 31, 2021 at 12:38:07PM +0200, Hans de Goede wrote: >> On 3/8/21 11:31 AM, Hans de Goede wrote: >>> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >>> >>> Some devices reference an output terminal as the source of extension >>> units. This is incorrect, as output terminals only have an input pin, >>> and thus can't be connected to any entity in the forward direction. The >>> resulting topology would cause issues when registering the media >>> controller graph. To avoid this problem, connect the extension unit to >>> the source of the output terminal instead. >>> >>> While at it, and while no device has been reported to be affected by >>> this issue, also handle forward scans where two output terminals would >>> be connected together, and skip the terminals found through such an >>> invalid connection. >>> >>> Reported-and-tested-by: John Nealy <jnealy3@yahoo.com> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >>> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> >> Ping? This is a bug-fix which fixes a WARN triggering, causing many >> users to see a backtrace in their kernel-logs and reporting bugs about this: >> >> https://bugzilla.redhat.com/buglist.cgi?quicksearch=mc-entity.c >> >> Currently shows 12 open bugs for this and this is not counting all the >> ones which have already been triaged and matched as dups. >> >> As such it would be really good if we can get this merged and on >> its way to 5.12-rc# as a fix for 5.12 (and to be backported to the >> stable series). > > The patch is included in "[GIT PULL FOR v5.13] Miscellaneous changes". Ah I missed that. > I have no personal issue with it being merged in v5.12-rc, but technically > it's not a regression fix, is it ? I'll let Mauro decide what works best > for him. It is true that this is not a regression-fix but it is a bug-fix and for a bug which users are actively hitting. Regards, Hans > >>> --- >>> drivers/media/usb/uvc/uvc_driver.c | 32 ++++++++++++++++++++++++++++++ >>> 1 file changed, 32 insertions(+) >>> >>> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c >>> index 30ef2a3110f7..8df58f04dac6 100644 >>> --- a/drivers/media/usb/uvc/uvc_driver.c >>> +++ b/drivers/media/usb/uvc/uvc_driver.c >>> @@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, >>> return -EINVAL; >>> } >>> >>> + /* >>> + * Some devices reference an output terminal as the >>> + * source of extension units. This is incorrect, as >>> + * output terminals only have an input pin, and thus >>> + * can't be connected to any entity in the forward >>> + * direction. The resulting topology would cause issues >>> + * when registering the media controller graph. To >>> + * avoid this problem, connect the extension unit to >>> + * the source of the output terminal instead. >>> + */ >>> + if (UVC_ENTITY_IS_OTERM(entity)) { >>> + struct uvc_entity *source; >>> + >>> + source = uvc_entity_by_id(chain->dev, >>> + entity->baSourceID[0]); >>> + if (!source) { >>> + uvc_dbg(chain->dev, DESCR, >>> + "Can't connect extension unit %u in chain\n", >>> + forward->id); >>> + break; >>> + } >>> + >>> + forward->baSourceID[0] = source->id; >>> + } >>> + >>> list_add_tail(&forward->chain, &chain->entities); >>> if (!found) >>> uvc_dbg_cont(PROBE, " (->"); >>> @@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, >>> return -EINVAL; >>> } >>> >>> + if (UVC_ENTITY_IS_OTERM(entity)) { >>> + uvc_dbg(chain->dev, DESCR, >>> + "Unsupported connection between output terminals %u and %u\n", >>> + entity->id, forward->id); >>> + break; >>> + } >>> + >>> list_add_tail(&forward->chain, &chain->entities); >>> if (!found) >>> uvc_dbg_cont(PROBE, " (->"); > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-31 11:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-08 10:31 [PATCH 0/1] media: uvcvideo: Support devices that report an OT as an entity source Hans de Goede 2021-03-08 10:31 ` [PATCH 1/1] " Hans de Goede 2021-03-31 10:38 ` Hans de Goede 2021-03-31 11:03 ` Laurent Pinchart 2021-03-31 11:37 ` Hans de Goede
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.