From: David Miller <davem@davemloft.net>
To: tlfalcon@linux.vnet.ibm.com
Cc: netdev@vger.kernel.org, jstancek@redhat.com
Subject: Re: [PATCH net v2] ibmveth: Disable tx queue while changing mtu
Date: Sat, 13 Aug 2016 15:07:18 -0700 (PDT) [thread overview]
Message-ID: <20160813.150718.707775477809550559.davem@davemloft.net> (raw)
In-Reply-To: <1470945679-29133-1-git-send-email-tlfalcon@linux.vnet.ibm.com>
From: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Date: Thu, 11 Aug 2016 15:01:19 -0500
> If the device is running while the MTU is changed, ibmveth
> is closed and the bounce buffer is freed. If a transmission
> is sent before ibmveth can be reopened, ibmveth_start_xmit
> tries to copy to the null bounce buffer, leading to a kernel
> oops. The proposed solution disables the tx queue until
> ibmveth is restarted.
>
> The error recovery mechanism is revised to revert back to
> the original MTU configuration in case there is a failure
> when restarting the device.
>
> Reported-by: Jan Stancek <jstancek@redhat.com>
> Tested-by: Jan Stancek <jstancek@redhat.com>
> Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
> ---
> v2: rewrote error checking mechanism to revert to original MTU
> configuration on failure in accordance with David Miller's comments
This is a step in the right direction but misses the mark still.
Reverting to the original MTU can still fail via the call to
ibmveth_open(), with -ENOMEM or whatever, and this will leave
the device inoperative. This is exactly the behavior which
must be avoided.
This change has to be reworked it so that a guaranteed rewind from
ibmveth_open() can be performed no matter what happens.
This means you must rework how ibmveth_open() works such that there
is a prepare and a commit phase for all resources whose allocations
can fail.
For example, you must not throw away the original ->buffer_list_addr
and ->filter_list_addr buffers, you must not throw away the DMA
allocations made to adapter->rx_queue.queue_addr...
And on and on and on, for everything ibmveth_open() does.
If set MTU fails, the device must return to the orignal MTU and it
must be fully operational. Restoring to the orignal MTU cannot fail.
I know this is perhaps hard, but sometimes correct is hard.
Thanks.
prev parent reply other threads:[~2016-08-14 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 20:01 [PATCH net v2] ibmveth: Disable tx queue while changing mtu Thomas Falcon
2016-08-13 22:07 ` David Miller [this message]
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=20160813.150718.707775477809550559.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jstancek@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tlfalcon@linux.vnet.ibm.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).