From: Bin Gao <bin.gao@linux.intel.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Bin Gao <bin.gao@intel.com>,
Chandra Sekhar Anagani <chandra.sekhar.anagani@intel.com>
Subject: Re: [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support
Date: Fri, 15 Jul 2016 15:33:57 -0700 [thread overview]
Message-ID: <20160715223357.GA159605@worksta> (raw)
In-Reply-To: <1468564268.2195.10.camel@suse.com>
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.
next prev parent reply other threads:[~2016-07-15 22:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-15 2:14 [PATCH 1/2] usb: typec: Add USB Power Delivery sink port support Bin Gao
2016-07-15 6:31 ` Oliver Neukum
2016-07-15 22:33 ` Bin Gao [this message]
2016-07-15 7:25 ` Felipe Balbi
2016-07-15 8:44 ` Oliver Neukum
2016-07-15 10:30 ` Felipe Balbi
2016-07-15 13:13 ` Felipe Balbi
2016-07-15 23:49 ` Bin Gao
2016-07-18 7:07 ` Felipe Balbi
2016-07-19 5:39 ` Bin Gao
2016-07-19 8:29 ` Felipe Balbi
2016-07-15 10:38 ` Felipe Balbi
2016-07-15 11:11 ` Greg Kroah-Hartman
2016-07-15 11:21 ` Felipe Balbi
2016-07-15 22:41 ` Bin Gao
2016-07-15 23:49 ` Greg Kroah-Hartman
2016-07-19 5:30 ` Bin Gao
2016-07-19 8:30 ` Felipe Balbi
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=20160715223357.GA159605@worksta \
--to=bin.gao@linux.intel.com \
--cc=bin.gao@intel.com \
--cc=chandra.sekhar.anagani@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.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 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.