From: Greg KH <greg@kroah.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>, David Miller <davem@davemloft.net>,
Networking <netdev@vger.kernel.org>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
Stephen Hemminger <sthemmin@microsoft.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: linux-next: manual merge of the char-misc tree with the net-next tree
Date: Mon, 5 Sep 2016 13:33:53 +0200 [thread overview]
Message-ID: <20160905113353.GB27586@kroah.com> (raw)
In-Reply-To: <20160905165650.180e6c89@canb.auug.org.au>
On Mon, Sep 05, 2016 at 04:56:50PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the char-misc tree got a conflict in:
>
> include/linux/hyperv.h
>
> between commit:
>
> 30d1de08c87d ("hv_netvsc: make inline functions static")
>
> from the net-next tree and commit:
>
> bb08d431a914 ("Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw()")
>
> from the char-misc tree.
>
> I fixed it up (the former moved the code modified by the latter, so the
> below patch applies to the new location of the code) and can carry the
> fix as necessary. This is now fixed as far as linux-next is concerned,
> but any non trivial conflicts should be mentioned to your upstream
> maintainer when your tree is submitted for merging. You may also want
> to consider cooperating with the maintainer of the conflicting tree to
> minimise any particularly complex conflicts.
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Mon, 5 Sep 2016 16:53:06 +1000
> Subject: [PATCH] Drivers: hv: ring_buffer: merge fix up for "hv_netvsc: make
> inline functions static"
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
> drivers/net/hyperv/netvsc.c | 32 +++++++++++---------------------
> 1 file changed, 11 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index 2a9ccc4d9e3c..026df6556068 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -42,31 +42,23 @@ static struct vmpacket_descriptor *
> get_next_pkt_raw(struct vmbus_channel *channel)
> {
> struct hv_ring_buffer_info *ring_info = &channel->inbound;
> - u32 read_loc = ring_info->priv_read_index;
> + u32 priv_read_loc = ring_info->priv_read_index;
> void *ring_buffer = hv_get_ring_buffer(ring_info);
> - struct vmpacket_descriptor *cur_desc;
> - u32 packetlen;
> u32 dsize = ring_info->ring_datasize;
> - u32 delta = read_loc - ring_info->ring_buffer->read_index;
> + /*
> + * delta is the difference between what is available to read and
> + * what was already consumed in place. We commit read index after
> + * the whole batch is processed.
> + */
> + u32 delta = priv_read_loc >= ring_info->ring_buffer->read_index ?
> + priv_read_loc - ring_info->ring_buffer->read_index :
> + (dsize - ring_info->ring_buffer->read_index) + priv_read_loc;
> u32 bytes_avail_toread = (hv_get_bytes_to_read(ring_info) - delta);
>
> if (bytes_avail_toread < sizeof(struct vmpacket_descriptor))
> return NULL;
>
> - if ((read_loc + sizeof(*cur_desc)) > dsize)
> - return NULL;
> -
> - cur_desc = ring_buffer + read_loc;
> - packetlen = cur_desc->len8 << 3;
> -
> - /*
> - * If the packet under consideration is wrapping around,
> - * return failure.
> - */
> - if ((read_loc + packetlen + VMBUS_PKT_TRAILER) > (dsize - 1))
> - return NULL;
> -
> - return cur_desc;
> + return ring_buffer + priv_read_loc;
> }
>
> /*
> @@ -78,16 +70,14 @@ static void put_pkt_raw(struct vmbus_channel *channel,
> struct vmpacket_descriptor *desc)
> {
> struct hv_ring_buffer_info *ring_info = &channel->inbound;
> - u32 read_loc = ring_info->priv_read_index;
> u32 packetlen = desc->len8 << 3;
> u32 dsize = ring_info->ring_datasize;
>
> - BUG_ON((read_loc + packetlen + VMBUS_PKT_TRAILER) > dsize);
> -
> /*
> * Include the packet trailer.
> */
> ring_info->priv_read_index += packetlen + VMBUS_PKT_TRAILER;
> + ring_info->priv_read_index %= dsize;
> }
>
> /*
Ugh, messy. Thanks for this.
KY, how did this happen?
greg k-h
next prev parent reply other threads:[~2016-09-05 11:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 6:56 linux-next: manual merge of the char-misc tree with the net-next tree Stephen Rothwell
2016-09-05 11:33 ` Greg KH [this message]
2016-09-06 5:36 ` KY Srinivasan
2016-09-06 10:28 ` KY Srinivasan
[not found] ` <BLUPR0301MB209827200D789C51EC56DA41CCF90@BLUPR0301MB2098.namprd03.prod.outlook.com>
2016-09-07 6:47 ` Greg KH
[not found] ` <BY2PR0301MB2104C50A152139E94BC3E442CCF80@BY2PR0301MB2104.namprd03.prod.outlook.com>
2016-09-08 10:21 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2018-12-20 6:02 Stephen Rothwell
2018-12-20 6:32 ` Greg KH
2022-03-15 5:45 Stephen Rothwell
2022-03-15 7:35 ` Greg KH
2022-03-22 8:53 ` Geert Uytterhoeven
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=20160905113353.GB27586@kroah.com \
--to=greg@kroah.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=sthemmin@microsoft.com \
--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 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).