Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444648
| From | Bin Gao <bin.gao@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support |
| Date | 2016-07-16 00:30 +0200 |
| Message-ID | <rVjMm-47e-31@gated-at.bofh.it> (permalink) |
| References | <rV0Tn-ZV-7@gated-at.bofh.it> <rV4WZ-3uz-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jul 15, 2016 at 08:31:08AM +0200, Oliver Neukum wrote:
> > +static void ack_message(struct pd_sink_port *port, int msg_id)
> > +{
> > + struct pd_msg_header *header = kzalloc(PD_MSG_HEADER_LEN, GFP_KERNEL);
>
> This must be GFP_NOIO. We are in a cycle that can lead to deadlock.
>
> Assume we are waiting for a request for more power to process IO
> which we need to ack.
>
> 1. memory allocation leads to laundering, blocks on freeing memory
> 2. launderer decides to perform IO which needs more power
> 3. more power has already been requested, wait for it to be granted
>
> 4. BANG - DEADLOCK
Agree, I'll change the GFP flag in next revision.
> > + struct pd_msg_header *header = kzalloc(PD_MSG_HEADER_LEN +
> > + port->nr_ps * PD_OBJ_SIZE, GFP_KERNEL);
>
> Must be GFP_NOIO. For the same reason as above. We may be asked
> this to resolve a mismatch due to needing more power for IO.
Yes will do.
> > +static void handle_soft_reset(struct pd_sink_port *port)
> > +{
> > + struct pd_msg_header *header = kzalloc(PD_MSG_HEADER_LEN, GFP_KERNEL);
> > +
> > + if (!header)
> > + return;
> > +
> > + flush_workqueue(port->rx_wq);
>
> That is problematic. We may be here precisely because something is wrong
> blocking progress. In particular what happens if another soft reset
> is queued?
I'm going to remove the workqueue.
> > + struct pd_msg_header *header = kzalloc(PD_MSG_HEADER_LEN +
> > + PD_OBJ_SIZE, GFP_KERNEL);
>
> GFP_NOIO, same reasons
Yes.
> > +
>
> HTH
> Oliver
Thanks for your review.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Oliver Neukum <oneukum@suse.com> - 2016-07-15 08:40 +0200 Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Bin Gao <bin.gao@linux.intel.com> - 2016-07-16 00:30 +0200
csiph-web