Message ID | 20240308121338.1983-1-yongsuyoo0215@gmail.com |
---|---|
State | New |
Headers | show |
Series | media: dvb_ca_en50221: Add a returing EBUSY logic into CA_RESET | expand |
Dear All Can you review this patch ? Can you share how this modification is going ? 2024년 3월 8일 (금) 오후 9:13, <yongsuyoo0215@gmail.com>님이 작성: > > From: Yongsu yoo <yongsuyoo0215@gmail.com> > > Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> > > In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET ioctl > is called, in a normal case, the state of the thread of the > dvb_ca_en50221_thread_state_machine will transit like below order. > DVB_CA_SLOTSTATE_NONE -> DVB_CA_SLOTSTATE_UNINITIALISED -> > DVB_CA_SLOTSTATE_WAITREADY -> DVB_CA_SLOTSTATE_VALIDATE -> > DVB_CA_SLOTSTATE_WAITFR -> DVB_CA_SLOTSTATE_LINKINIT -> > DVB_CA_SLOTSTATE_RUNNING > But in some problem cases, the state will become DVB_CA_SLOTSTATE_INVALID. > Among the above mentioned states, the DVB_CA_SLOTSTATE_NONE and > the DVB_CA_SLOTSTATE_INVALID are "already stablized" states, > whereas other states are "transiting" states. > The "already stablized" states mean no matter how long time we wait, > the state will not be changed. > The "transiting" states mean the states whose final state is not yet > determined. The state keeps to be changed. Only after some time passes, > we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNING > or DVB_CA_SLOTSTATE_INVALID. > During the "transiting" states, we do not yet know whether the > CA_RESET operation, which triggered the "transiting" states, will > succeed or fail. For this reason, during the "transiting" states, if > another CA_RESET ioctl is called and if this new CA_RESET ioctl > operation begins again, it will be meaningless and waste time. > For preventing this problem from happening, we make CA_RESET ioctl do > nothing and only return EBUSY if the ioctl is called during the > "transiting" states. > --- > drivers/media/dvb-core/dvb_ca_en50221.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c > index baf64540dc00..2e8aec354b7c 100644 > --- a/drivers/media/dvb-core/dvb_ca_en50221.c > +++ b/drivers/media/dvb-core/dvb_ca_en50221.c > @@ -1362,13 +1362,19 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, > struct dvb_ca_slot *sl = &ca->slot_info[slot]; > > mutex_lock(&sl->slot_lock); > - if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > + if ((sl->slot_state == DVB_CA_SLOTSTATE_RUNNING) || > + (sl->slot_state == DVB_CA_SLOTSTATE_INVALID)) { > dvb_ca_en50221_slot_shutdown(ca, slot); > if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE) > dvb_ca_en50221_camchange_irq(ca->pub, > slot, > DVB_CA_EN50221_CAMCHANGE_INSERTED); > } > + else { > + if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > + err = -EBUSY; > + } > + } > mutex_unlock(&sl->slot_lock); > } > ca->next_read_slot = 0; > -- > 2.17.1 >
Dear All Can you review this patch ? Can you share how this modification is going ? 2024년 4월 11일 (목) 오후 9:02, YongSu Yoo <yongsuyoo0215@gmail.com>님이 작성: > > Dear All > > Can you review this patch ? > Can you share how this modification is going ? > > 2024년 3월 8일 (금) 오후 9:13, <yongsuyoo0215@gmail.com>님이 작성: > > > > From: Yongsu yoo <yongsuyoo0215@gmail.com> > > > > Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> > > > > In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET ioctl > > is called, in a normal case, the state of the thread of the > > dvb_ca_en50221_thread_state_machine will transit like below order. > > DVB_CA_SLOTSTATE_NONE -> DVB_CA_SLOTSTATE_UNINITIALISED -> > > DVB_CA_SLOTSTATE_WAITREADY -> DVB_CA_SLOTSTATE_VALIDATE -> > > DVB_CA_SLOTSTATE_WAITFR -> DVB_CA_SLOTSTATE_LINKINIT -> > > DVB_CA_SLOTSTATE_RUNNING > > But in some problem cases, the state will become DVB_CA_SLOTSTATE_INVALID. > > Among the above mentioned states, the DVB_CA_SLOTSTATE_NONE and > > the DVB_CA_SLOTSTATE_INVALID are "already stablized" states, > > whereas other states are "transiting" states. > > The "already stablized" states mean no matter how long time we wait, > > the state will not be changed. > > The "transiting" states mean the states whose final state is not yet > > determined. The state keeps to be changed. Only after some time passes, > > we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNING > > or DVB_CA_SLOTSTATE_INVALID. > > During the "transiting" states, we do not yet know whether the > > CA_RESET operation, which triggered the "transiting" states, will > > succeed or fail. For this reason, during the "transiting" states, if > > another CA_RESET ioctl is called and if this new CA_RESET ioctl > > operation begins again, it will be meaningless and waste time. > > For preventing this problem from happening, we make CA_RESET ioctl do > > nothing and only return EBUSY if the ioctl is called during the > > "transiting" states. > > --- > > drivers/media/dvb-core/dvb_ca_en50221.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c > > index baf64540dc00..2e8aec354b7c 100644 > > --- a/drivers/media/dvb-core/dvb_ca_en50221.c > > +++ b/drivers/media/dvb-core/dvb_ca_en50221.c > > @@ -1362,13 +1362,19 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, > > struct dvb_ca_slot *sl = &ca->slot_info[slot]; > > > > mutex_lock(&sl->slot_lock); > > - if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > > + if ((sl->slot_state == DVB_CA_SLOTSTATE_RUNNING) || > > + (sl->slot_state == DVB_CA_SLOTSTATE_INVALID)) { > > dvb_ca_en50221_slot_shutdown(ca, slot); > > if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE) > > dvb_ca_en50221_camchange_irq(ca->pub, > > slot, > > DVB_CA_EN50221_CAMCHANGE_INSERTED); > > } > > + else { > > + if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > > + err = -EBUSY; > > + } > > + } > > mutex_unlock(&sl->slot_lock); > > } > > ca->next_read_slot = 0; > > -- > > 2.17.1 > >
Dear All Can you review this patch ? Can you share how this modification is going ? 2024년 5월 1일 (수) 오후 4:54, YongSu Yoo <yongsuyoo0215@gmail.com>님이 작성: > > Dear All > > Can you review this patch ? > Can you share how this modification is going ? > > 2024년 4월 11일 (목) 오후 9:02, YongSu Yoo <yongsuyoo0215@gmail.com>님이 작성: > > > > Dear All > > > > Can you review this patch ? > > Can you share how this modification is going ? > > > > 2024년 3월 8일 (금) 오후 9:13, <yongsuyoo0215@gmail.com>님이 작성: > > > > > > From: Yongsu yoo <yongsuyoo0215@gmail.com> > > > > > > Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> > > > > > > In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET ioctl > > > is called, in a normal case, the state of the thread of the > > > dvb_ca_en50221_thread_state_machine will transit like below order. > > > DVB_CA_SLOTSTATE_NONE -> DVB_CA_SLOTSTATE_UNINITIALISED -> > > > DVB_CA_SLOTSTATE_WAITREADY -> DVB_CA_SLOTSTATE_VALIDATE -> > > > DVB_CA_SLOTSTATE_WAITFR -> DVB_CA_SLOTSTATE_LINKINIT -> > > > DVB_CA_SLOTSTATE_RUNNING > > > But in some problem cases, the state will become DVB_CA_SLOTSTATE_INVALID. > > > Among the above mentioned states, the DVB_CA_SLOTSTATE_NONE and > > > the DVB_CA_SLOTSTATE_INVALID are "already stablized" states, > > > whereas other states are "transiting" states. > > > The "already stablized" states mean no matter how long time we wait, > > > the state will not be changed. > > > The "transiting" states mean the states whose final state is not yet > > > determined. The state keeps to be changed. Only after some time passes, > > > we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNING > > > or DVB_CA_SLOTSTATE_INVALID. > > > During the "transiting" states, we do not yet know whether the > > > CA_RESET operation, which triggered the "transiting" states, will > > > succeed or fail. For this reason, during the "transiting" states, if > > > another CA_RESET ioctl is called and if this new CA_RESET ioctl > > > operation begins again, it will be meaningless and waste time. > > > For preventing this problem from happening, we make CA_RESET ioctl do > > > nothing and only return EBUSY if the ioctl is called during the > > > "transiting" states. > > > --- > > > drivers/media/dvb-core/dvb_ca_en50221.c | 8 +++++++- > > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c > > > index baf64540dc00..2e8aec354b7c 100644 > > > --- a/drivers/media/dvb-core/dvb_ca_en50221.c > > > +++ b/drivers/media/dvb-core/dvb_ca_en50221.c > > > @@ -1362,13 +1362,19 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, > > > struct dvb_ca_slot *sl = &ca->slot_info[slot]; > > > > > > mutex_lock(&sl->slot_lock); > > > - if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > > > + if ((sl->slot_state == DVB_CA_SLOTSTATE_RUNNING) || > > > + (sl->slot_state == DVB_CA_SLOTSTATE_INVALID)) { > > > dvb_ca_en50221_slot_shutdown(ca, slot); > > > if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE) > > > dvb_ca_en50221_camchange_irq(ca->pub, > > > slot, > > > DVB_CA_EN50221_CAMCHANGE_INSERTED); > > > } > > > + else { > > > + if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { > > > + err = -EBUSY; > > > + } > > > + } > > > mutex_unlock(&sl->slot_lock); > > > } > > > ca->next_read_slot = 0; > > > -- > > > 2.17.1 > > >
… > For preventing this problem from happening, we make CA_RESET ioctl do > nothing and only return EBUSY if the ioctl is called during the > "transiting" states. Would you like to avoid any typos (in the summary phrase)? Regards, Markus
Dear Markus Elfring Initially, I sent this E-mail using the below command "....git send-email --to mchehab@kernel.org, linux-media@vger.kernel.org, xxxxxxxxxxx.patch. ..." In response to what you suggested, is it OK if I use Gmail and attach a new patch ? 2024년 5월 28일 (화) 오후 2:38, Markus Elfring <Markus.Elfring@web.de>님이 작성: > > … > > For preventing this problem from happening, we make CA_RESET ioctl do > > nothing and only return EBUSY if the ioctl is called during the > > "transiting" states. > > Would you like to avoid any typos (in the summary phrase)? > > Regards, > Markus
Em Tue, 28 May 2024 21:14:37 +0900 YongSu Yoo <yongsuyoo0215@gmail.com> escreveu: > Dear Markus Elfring Please don't top-post. Makes hard to follow the comments. > > > 2024년 5월 28일 (화) 오후 2:38, Markus Elfring <Markus.Elfring@web.de>님이 작성: > > > > > … > > > For preventing this problem from happening, we make CA_RESET ioctl do > > > nothing and only return EBUSY if the ioctl is called during the > > > "transiting" states. > > > > Would you like to avoid any typos (in the summary phrase)? > Initially, I sent this E-mail using the below command > "....git send-email --to mchehab@kernel.org, > linux-media@vger.kernel.org, xxxxxxxxxxx.patch. ..." Git send-email is a good way to send patches. You may also use a decent e-mail client that won't mangle with whitespaces. I use myself claws-mail; other develpers use emacs. Feel free to pick your poison, but if the email doesn't handle whitespaces well and/or don't allow writing the answers below the original comments (instead of top-posting), it shouldn't be used. > In response to what you suggested, is it OK if I use Gmail and attach > a new patch ? No. Never attach a patch as the mailing list will reject, and if not, patchwork.linuxtv.org won't pick it. You may use gmail, if you setup your e-mail client to use it as a SMTP server. Using webmail solutions typically won't work open source discussions, as it does lots of wrong things, like top-posting, not honoring 80 columns on emails and/or mangling tabs and white spaces. Thanks, Mauro
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index baf64540dc00..2e8aec354b7c 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1362,13 +1362,19 @@ static int dvb_ca_en50221_io_do_ioctl(struct file *file, struct dvb_ca_slot *sl = &ca->slot_info[slot]; mutex_lock(&sl->slot_lock); - if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { + if ((sl->slot_state == DVB_CA_SLOTSTATE_RUNNING) || + (sl->slot_state == DVB_CA_SLOTSTATE_INVALID)) { dvb_ca_en50221_slot_shutdown(ca, slot); if (ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE) dvb_ca_en50221_camchange_irq(ca->pub, slot, DVB_CA_EN50221_CAMCHANGE_INSERTED); } + else { + if (sl->slot_state != DVB_CA_SLOTSTATE_NONE) { + err = -EBUSY; + } + } mutex_unlock(&sl->slot_lock); } ca->next_read_slot = 0;
From: Yongsu yoo <yongsuyoo0215@gmail.com> Signed-off-by:Yongsu Yoo <yongsuyoo0215@gmail.com> In source/drivers/media/dvb-core/dvb_ca_en50221.c, if the CA_RESET ioctl is called, in a normal case, the state of the thread of the dvb_ca_en50221_thread_state_machine will transit like below order. DVB_CA_SLOTSTATE_NONE -> DVB_CA_SLOTSTATE_UNINITIALISED -> DVB_CA_SLOTSTATE_WAITREADY -> DVB_CA_SLOTSTATE_VALIDATE -> DVB_CA_SLOTSTATE_WAITFR -> DVB_CA_SLOTSTATE_LINKINIT -> DVB_CA_SLOTSTATE_RUNNING But in some problem cases, the state will become DVB_CA_SLOTSTATE_INVALID. Among the above mentioned states, the DVB_CA_SLOTSTATE_NONE and the DVB_CA_SLOTSTATE_INVALID are "already stablized" states, whereas other states are "transiting" states. The "already stablized" states mean no matter how long time we wait, the state will not be changed. The "transiting" states mean the states whose final state is not yet determined. The state keeps to be changed. Only after some time passes, we get to know whether the final state will be DVB_CA_SLOTSTATE_RUNNING or DVB_CA_SLOTSTATE_INVALID. During the "transiting" states, we do not yet know whether the CA_RESET operation, which triggered the "transiting" states, will succeed or fail. For this reason, during the "transiting" states, if another CA_RESET ioctl is called and if this new CA_RESET ioctl operation begins again, it will be meaningless and waste time. For preventing this problem from happening, we make CA_RESET ioctl do nothing and only return EBUSY if the ioctl is called during the "transiting" states. --- drivers/media/dvb-core/dvb_ca_en50221.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)