linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Qiang" <Qiang.Zhang@windriver.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "zaitcev@redhat.com" <zaitcev@redhat.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: 回复: 回复: 回复: [PATCH] USB: usblp: Add device status detection in usblp_poll()
Date: Tue, 2 Mar 2021 07:41:07 +0000	[thread overview]
Message-ID: <BYAPR11MB263258B4BD102A08BF454D82FF999@BYAPR11MB2632.namprd11.prod.outlook.com> (raw)
In-Reply-To: <YD3jlIR7UJjXT6Se@kroah.com>


On Mon, Mar 01, 2021 at 08:52:58AM +0000, Zhang, Qiang wrote:
>
>
> ________________________________________
> 发件人: Greg KH <gregkh@linuxfoundation.org>
> 发送时间: 2021年3月1日 16:32
> 收件人: Zhang, Qiang
> 抄送: zaitcev@redhat.com; linux-usb@vger.kernel.org
> 主题: Re: 回复: [PATCH] USB: usblp: Add device status detection in usblp_poll()
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Mon, Mar 01, 2021 at 08:26:22AM +0000, Zhang, Qiang wrote:
> >
> >
> > ________________________________________
> > 发件人: Greg KH <gregkh@linuxfoundation.org>
> > 发送时间: 2021年3月1日 16:00
> > 收件人: Zhang, Qiang
> > 抄送: zaitcev@redhat.com; linux-usb@vger.kernel.org
> > 主题: Re: [PATCH] USB: usblp: Add device status detection in usblp_poll()
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On Mon, Mar 01, 2021 at 12:03:00PM +0800, qiang.zhang@windriver.com wrote:
> > > From: Zqiang <qiang.zhang@windriver.com>
> > >
> > > If usblp device has been disconnected, direct return
> > > 'EPOLLHUP | EPOLLERR' in usblp_poll().
> > >
> > >Why?  What problem are you solving here?  Is this fixing an >older
> > >commit, if so, what one?
> > >
> >
> > There is not need fix older commit.
> > After the device is disconnected, if the userspace call >poll/select() function, will block and never be awakened .
> >
> >If the device is disconnected, how can the file be opened at >all?
> >Shouldn't it have been torn down already?
>
> If the device disconnect happen after the file be opend, and then we call poll/select() will always blocked.
> Also  before we operate the device, we need to judge the state of the >device. If it is disconnected, there is no need for subsequent >operation .
>
>But shouldn't the normal call to poll_wait() fail here?

poll_wait() is not fail,  its main operation is to call  add_wait_queue()

>
> >And now you are holding a lock across some poll_wait() calls, >is >that
> >going to cause problems?
>
> The 'usblp->present' is portect by 'usblp->mut',  when devices disconnect, will acquire 'usblp->mut', and set 'usblp->present'
> zero.
>
>But you are now holding a mutex across a very very long period of >time,
>what will that change?

maybe acquire mutex lock will take a long time,  but it's safe.

and also I find  similar usage in usb/class/usbtmc.c

thanks
Qiang
>
>thanks,
>
>greg k-h

  reply	other threads:[~2021-03-02 11:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  4:03 [PATCH] USB: usblp: Add device status detection in usblp_poll() qiang.zhang
2021-03-01  8:00 ` Greg KH
2021-03-01  8:26   ` 回复: " Zhang, Qiang
2021-03-01  8:32     ` Greg KH
2021-03-01  8:52       ` 回复: " Zhang, Qiang
2021-03-02  7:04         ` Greg KH
2021-03-02  7:41           ` Zhang, Qiang [this message]
2021-03-03  5:12             ` Pete Zaitcev
2021-03-03  6:12               ` 回复: " Zhang, Qiang
2021-03-03  6:56                 ` Greg KH
2021-03-03  7:15                 ` Zhang, Qiang
2021-03-03 15:57                   ` Pete Zaitcev
2021-03-03 17:13               ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR11MB263258B4BD102A08BF454D82FF999@BYAPR11MB2632.namprd11.prod.outlook.com \
    --to=qiang.zhang@windriver.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).