From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Dexuan Cui <decui@microsoft.com>
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
driverdev-devel@linuxdriverproject.org, olaf@aepfle.de,
apw@canonical.com, jasowang@redhat.com, kys@microsoft.com,
haiyangz@microsoft.com
Subject: Re: [PATCH 3/3] hv: vmbus_open(): reset the channel state on ENOMEM
Date: Thu, 29 Jan 2015 14:22:20 +0100 [thread overview]
Message-ID: <87fvat7mcz.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <1422529370-28261-1-git-send-email-decui@microsoft.com> (Dexuan Cui's message of "Thu, 29 Jan 2015 03:02:50 -0800")
Dexuan Cui <decui@microsoft.com> writes:
> Without this patch, the state is put to CHANNEL_OPENING_STATE, and when
> the driver is loaded next time, vmbus_open() will fail immediately due to
> newchannel->state != CHANNEL_OPEN_STATE.
The patch makes sense, but I have one small doubt. We call vmbus_open
from probe functions of various devices. E.g. in hyperv-keyboard we
have:
error = vmbus_open(...)
if (error)
goto err_free_mem;
and we don't call vmbus_close(...) on this path so no
CHANNELMSG_CLOSECHANNEL will be send. Who's gonna retry probe? Wouldn't
it be better to close the channel?
>
> CC: "K. Y. Srinivasan" <kys@microsoft.com>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
> drivers/hv/channel.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
> index 2978f5e..26dcf26 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
> @@ -89,9 +89,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
> out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
> get_order(send_ringbuffer_size + recv_ringbuffer_size));
>
> - if (!out)
> - return -ENOMEM;
> -
> + if (!out) {
> + err = -ENOMEM;
> + goto error0;
> + }
>
> in = (void *)((unsigned long)out + send_ringbuffer_size);
>
> @@ -199,6 +200,7 @@ error0:
> free_pages((unsigned long)out,
> get_order(send_ringbuffer_size + recv_ringbuffer_size));
> kfree(open_info);
> + newchannel->state = CHANNEL_OPEN_STATE;
> return err;
> }
> EXPORT_SYMBOL_GPL(vmbus_open);
--
Vitaly
next prev parent reply other threads:[~2015-01-29 13:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-29 11:02 [PATCH 3/3] hv: vmbus_open(): reset the channel state on ENOMEM Dexuan Cui
2015-01-29 13:22 ` Vitaly Kuznetsov [this message]
2015-01-30 5:03 ` Dexuan Cui
2015-02-01 19:42 ` KY Srinivasan
2015-02-02 2:37 ` Dexuan Cui
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=87fvat7mcz.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=apw@canonical.com \
--cc=decui@microsoft.com \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
/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.