From: Greg KH <gregkh@linuxfoundation.org>
To: Sumit Semwal <sumit.semwal@linaro.org>
Cc: stable@vger.kernel.org, Vitaly Kuznetsov <vkuznets@redhat.com>,
"K . Y . Srinivasan" <kys@microsoft.com>
Subject: Re: [v2 PATCH for-4.4 07/16] Drivers: hv: get rid of redundant messagecount in create_gpadl_header()
Date: Sun, 16 Apr 2017 10:00:00 +0200 [thread overview]
Message-ID: <20170416080000.GC24859@kroah.com> (raw)
In-Reply-To: <1492019030-13567-8-git-send-email-sumit.semwal@linaro.org>
On Wed, Apr 12, 2017 at 11:13:41PM +0530, Sumit Semwal wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> [ Upstream commit 4d63763296ab7865a98bc29cc7d77145815ef89f ]
>
> We use messagecount only once in vmbus_establish_gpadl() to check if
> it is safe to iterate through the submsglist. We can just initialize
> the list header in all cases in create_gpadl_header() instead.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
> ---
> drivers/hv/channel.c | 38 ++++++++++++++++----------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
> index 1ef37c7..fb1e3df 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
> @@ -223,8 +223,7 @@ EXPORT_SYMBOL_GPL(vmbus_open);
> * create_gpadl_header - Creates a gpadl for the specified buffer
> */
> static int create_gpadl_header(void *kbuffer, u32 size,
> - struct vmbus_channel_msginfo **msginfo,
> - u32 *messagecount)
> + struct vmbus_channel_msginfo **msginfo)
> {
> int i;
> int pagecount;
> @@ -268,7 +267,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
> gpadl_header->range[0].pfn_array[i] = slow_virt_to_phys(
> kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT;
> *msginfo = msgheader;
> - *messagecount = 1;
>
> pfnsum = pfncount;
> pfnleft = pagecount - pfncount;
> @@ -308,7 +306,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
> }
>
> msgbody->msgsize = msgsize;
> - (*messagecount)++;
> gpadl_body =
> (struct vmbus_channel_gpadl_body *)msgbody->msg;
>
> @@ -337,6 +334,8 @@ static int create_gpadl_header(void *kbuffer, u32 size,
> msgheader = kzalloc(msgsize, GFP_KERNEL);
> if (msgheader == NULL)
> goto nomem;
> +
> + INIT_LIST_HEAD(&msgheader->submsglist);
> msgheader->msgsize = msgsize;
>
> gpadl_header = (struct vmbus_channel_gpadl_header *)
> @@ -351,7 +350,6 @@ static int create_gpadl_header(void *kbuffer, u32 size,
> kbuffer + PAGE_SIZE * i) >> PAGE_SHIFT;
>
> *msginfo = msgheader;
> - *messagecount = 1;
> }
>
> return 0;
> @@ -376,7 +374,6 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
> struct vmbus_channel_gpadl_body *gpadl_body;
> struct vmbus_channel_msginfo *msginfo = NULL;
> struct vmbus_channel_msginfo *submsginfo;
> - u32 msgcount;
> struct list_head *curr;
> u32 next_gpadl_handle;
> unsigned long flags;
> @@ -385,7 +382,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
> next_gpadl_handle =
> (atomic_inc_return(&vmbus_connection.next_gpadl_handle) - 1);
>
> - ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
> + ret = create_gpadl_header(kbuffer, size, &msginfo);
> if (ret)
> return ret;
>
> @@ -408,24 +405,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
> if (ret != 0)
> goto cleanup;
>
> - if (msgcount > 1) {
> - list_for_each(curr, &msginfo->submsglist) {
> + list_for_each(curr, &msginfo->submsglist) {
> + submsginfo = (struct vmbus_channel_msginfo *)curr;
> + gpadl_body =
> + (struct vmbus_channel_gpadl_body *)submsginfo->msg;
>
> - submsginfo = (struct vmbus_channel_msginfo *)curr;
> - gpadl_body =
> - (struct vmbus_channel_gpadl_body *)submsginfo->msg;
> + gpadl_body->header.msgtype =
> + CHANNELMSG_GPADL_BODY;
> + gpadl_body->gpadl = next_gpadl_handle;
>
> - gpadl_body->header.msgtype =
> - CHANNELMSG_GPADL_BODY;
> - gpadl_body->gpadl = next_gpadl_handle;
> + ret = vmbus_post_msg(gpadl_body,
> + submsginfo->msgsize -
> + sizeof(*submsginfo));
> + if (ret != 0)
> + goto cleanup;
>
> - ret = vmbus_post_msg(gpadl_body,
> - submsginfo->msgsize -
> - sizeof(*submsginfo));
> - if (ret != 0)
> - goto cleanup;
> -
> - }
> }
> wait_for_completion(&msginfo->waitevent);
>
Why should this go into a stable kernel? What does it fix?
thanks,
greg k-h
next prev parent reply other threads:[~2017-04-16 8:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-12 17:43 [v2 PATCH for-4.4 00/16] Stable commits from Ubuntu Xenial 4.4-lts Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 01/16] net/mlx4_core: Fix when to save some qp context flags for dynamic VST to VGT transitions Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 02/16] net/mlx4_core: Fix racy CQ (Completion Queue) free Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 03/16] net/mlx4_en: Fix bad WQE issue Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 04/16] SUNRPC: fix refcounting problems with auth_gss messages Sumit Semwal
2017-04-16 7:59 ` Greg KH
[not found] ` <CAO_48GHUULUtHcvhkvxOr_tQ=q1vu+EVK3Ed09Bu3OsJpvC_CA@mail.gmail.com>
2017-04-16 10:30 ` Greg Kroah-Hartman
2017-04-12 17:43 ` [v2 PATCH for-4.4 05/16] ibmveth: set correct gso_size and gso_type Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 06/16] ibmveth: calculate gso_segs for large packets Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 07/16] Drivers: hv: get rid of redundant messagecount in create_gpadl_header() Sumit Semwal
2017-04-16 8:00 ` Greg KH [this message]
2017-04-17 14:49 ` Sumit Semwal
2017-04-19 12:58 ` Greg KH
2017-04-20 5:34 ` Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 08/16] Drivers: hv: don't leak memory in vmbus_establish_gpadl() Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 09/16] Drivers: hv: get rid of timeout in vmbus_open() Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 10/16] Drivers: hv: vmbus: Reduce the delay between retries in vmbus_post_msg() Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 11/16] Tools: hv: kvp: ensure kvp device fd is closed on exec Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 12/16] Drivers: hv: balloon: keep track of where ha_region starts Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 13/16] Drivers: hv: balloon: account for gaps in hot add regions Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 14/16] hv: don't reset hv_context.tsc_page on crash Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 15/16] blk-mq: Avoid memory reclaim when remapping queues Sumit Semwal
2017-04-12 17:43 ` [v2 PATCH for-4.4 16/16] usb: hub: Wait for connection to be reestablished after port reset Sumit Semwal
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=20170416080000.GC24859@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=kys@microsoft.com \
--cc=stable@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=vkuznets@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 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.