All of lore.kernel.org
 help / color / mirror / Atom feed
From: julien.grall@citrix.com (Julien Grall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 18/20] net/xen-netback: Make it running on 64KB page granularity
Date: Mon, 10 Aug 2015 10:57:48 +0100	[thread overview]
Message-ID: <55C8759C.3010507@citrix.com> (raw)
In-Reply-To: <20150808145534.GB14214@zion.uk.xensource.com>

Hi Wei,

On 08/08/2015 15:55, Wei Liu wrote:
>>   struct xenvif_rx_meta {
>>   	int id;
>> @@ -80,16 +81,18 @@ struct xenvif_rx_meta {
>>   /* Discriminate from any valid pending_idx value. */
>>   #define INVALID_PENDING_IDX 0xFFFF
>>
>> -#define MAX_BUFFER_OFFSET PAGE_SIZE
>> +#define MAX_BUFFER_OFFSET XEN_PAGE_SIZE
>>
>>   #define MAX_PENDING_REQS XEN_NETIF_TX_RING_SIZE
>>
>> +#define MAX_XEN_SKB_FRAGS (65536 / XEN_PAGE_SIZE + 1)
>> +
>
> It might be clearer if you add a comment saying the maximum number of
> frags is derived from the page size of the grant page, which happens to
> be XEN_PAGE_SIZE at the moment.

Will do.


> In the future we need to figure out the page size of grant page in a
> dynamic way. We shall cross the bridge when we get there.

Right, there is few other places where we would need to do that too (see 
MAX_BUFFER_OFFSET for instance).


[..]

>> +		info.page = page;
>> +		gnttab_foreach_grant_in_range(page, offset, bytes,
>> +					      xenvif_gop_frag_copy_grant,
>> +					      &info);
>
> Looks like I need to at least wait until the API is settle before giving
> my ack.
>
>>   		size -= bytes;
>> +		offset = 0;
>
> This looks wrong. Should be offset += bytes.

With the new implementation of the loop, each iteration will be on a 
different page.
So only the first page has an offset different than zero.

>
>>
>> -		/* Next frame */
>> -		if (offset == PAGE_SIZE && size) {
>> +		/* Next page */
>> +		if (size) {
>>   			BUG_ON(!PageCompound(page));
>>   			page++;
>> -			offset = 0;
>
> And this should not be deleted, I think.
>
> What is the reason for changing offset calculation? I think there is
> still compound page when using 64K page.

The compound pages are still working ... gnttab_foreach_grant_in_range 
is called once per page. So the offset can be reset to 0 every time. No 
need to add code which would make the result less clear.

We only need to know if the size is not 0 to get the next page.

The patch may not be clear enough to see it's working so I've copied the 
result loop below:

         while (size > 0) {
                 BUG_ON(offset >= PAGE_SIZE);

                 bytes = PAGE_SIZE - offset;
                 if (bytes > size)
                         bytes = size;

                 info.page = page;
                 gnttab_foreach_grant_in_range(page, offset, bytes,
                                              xenvif_gop_frag_copy_grant,
                                               &info);
                 size -= bytes;
                 offset = 0;

                 /* Next page */
                 if (size) {
                         BUG_ON(!PageCompound(page));
                         page++;
                 }
         }

Regards,

-- 
Julien Grall

WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <julien.grall@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: <xen-devel@lists.xenproject.org>,
	<linux-arm-kernel@lists.infradead.org>, <ian.campbell@citrix.com>,
	<stefano.stabellini@eu.citrix.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v3 18/20] net/xen-netback: Make it running on 64KB page granularity
Date: Mon, 10 Aug 2015 10:57:48 +0100	[thread overview]
Message-ID: <55C8759C.3010507@citrix.com> (raw)
In-Reply-To: <20150808145534.GB14214@zion.uk.xensource.com>

Hi Wei,

On 08/08/2015 15:55, Wei Liu wrote:
>>   struct xenvif_rx_meta {
>>   	int id;
>> @@ -80,16 +81,18 @@ struct xenvif_rx_meta {
>>   /* Discriminate from any valid pending_idx value. */
>>   #define INVALID_PENDING_IDX 0xFFFF
>>
>> -#define MAX_BUFFER_OFFSET PAGE_SIZE
>> +#define MAX_BUFFER_OFFSET XEN_PAGE_SIZE
>>
>>   #define MAX_PENDING_REQS XEN_NETIF_TX_RING_SIZE
>>
>> +#define MAX_XEN_SKB_FRAGS (65536 / XEN_PAGE_SIZE + 1)
>> +
>
> It might be clearer if you add a comment saying the maximum number of
> frags is derived from the page size of the grant page, which happens to
> be XEN_PAGE_SIZE at the moment.

Will do.


> In the future we need to figure out the page size of grant page in a
> dynamic way. We shall cross the bridge when we get there.

Right, there is few other places where we would need to do that too (see 
MAX_BUFFER_OFFSET for instance).


[..]

>> +		info.page = page;
>> +		gnttab_foreach_grant_in_range(page, offset, bytes,
>> +					      xenvif_gop_frag_copy_grant,
>> +					      &info);
>
> Looks like I need to at least wait until the API is settle before giving
> my ack.
>
>>   		size -= bytes;
>> +		offset = 0;
>
> This looks wrong. Should be offset += bytes.

With the new implementation of the loop, each iteration will be on a 
different page.
So only the first page has an offset different than zero.

>
>>
>> -		/* Next frame */
>> -		if (offset == PAGE_SIZE && size) {
>> +		/* Next page */
>> +		if (size) {
>>   			BUG_ON(!PageCompound(page));
>>   			page++;
>> -			offset = 0;
>
> And this should not be deleted, I think.
>
> What is the reason for changing offset calculation? I think there is
> still compound page when using 64K page.

The compound pages are still working ... gnttab_foreach_grant_in_range 
is called once per page. So the offset can be reset to 0 every time. No 
need to add code which would make the result less clear.

We only need to know if the size is not 0 to get the next page.

The patch may not be clear enough to see it's working so I've copied the 
result loop below:

         while (size > 0) {
                 BUG_ON(offset >= PAGE_SIZE);

                 bytes = PAGE_SIZE - offset;
                 if (bytes > size)
                         bytes = size;

                 info.page = page;
                 gnttab_foreach_grant_in_range(page, offset, bytes,
                                              xenvif_gop_frag_copy_grant,
                                               &info);
                 size -= bytes;
                 offset = 0;

                 /* Next page */
                 if (size) {
                         BUG_ON(!PageCompound(page));
                         page++;
                 }
         }

Regards,

-- 
Julien Grall

  parent reply	other threads:[~2015-08-10  9:57 UTC|newest]

Thread overview: 191+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 16:46 [PATCH v3 00/20] xen/arm64: Add support for 64KB page Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 01/20] net/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-08 13:59   ` Wei Liu
2015-08-08 13:59     ` Wei Liu
2015-08-08 13:59   ` Wei Liu
2015-08-07 16:46 ` [PATCH v3 02/20] arm/xen: Drop pte_mfn and mfn_pte Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 10:10   ` Stefano Stabellini
2015-08-10 10:10     ` Stefano Stabellini
2015-08-10 10:10   ` Stefano Stabellini
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 03/20] xen: Add Xen specific page definition Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 10:46   ` Stefano Stabellini
2015-08-10 10:46   ` Stefano Stabellini
2015-08-10 10:46     ` Stefano Stabellini
2015-08-20  9:49   ` David Vrabel
2015-08-20  9:49   ` [Xen-devel] " David Vrabel
2015-08-20  9:49     ` David Vrabel
2015-08-07 16:46 ` [PATCH v3 04/20] xen/grant: Introduce helpers to split a page into grant Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 10:44   ` Stefano Stabellini
2015-08-10 10:44   ` Stefano Stabellini
2015-08-10 10:44     ` Stefano Stabellini
2015-08-20  9:51   ` David Vrabel
2015-08-20  9:51   ` [Xen-devel] " David Vrabel
2015-08-20  9:51     ` David Vrabel
2015-08-28 14:29     ` Julien Grall
2015-08-28 14:29     ` [Xen-devel] " Julien Grall
2015-08-28 14:29       ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 05/20] xen/grant: Add helper gnttab_page_grant_foreign_access_ref_one Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 06/20] block/xen-blkfront: Split blkif_queue_request in 2 Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 07/20] block/xen-blkfront: Store a page rather a pfn in the grant structure Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 08/20] block/xen-blkfront: split get_grant in 2 Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-20  7:33   ` Roger Pau Monné
2015-08-20  7:33     ` Roger Pau Monné
2015-08-20  7:33   ` Roger Pau Monné
2015-08-07 16:46 ` [PATCH v3 09/20] xen/biomerge: Don't allow biovec to be merge when Linux is not using 4KB page Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 10:50   ` Stefano Stabellini
2015-08-10 10:50   ` Stefano Stabellini
2015-08-10 10:50     ` Stefano Stabellini
2015-08-10 11:24     ` Julien Grall
2015-08-10 11:24     ` [Xen-devel] " Julien Grall
2015-08-10 11:24       ` Julien Grall
2015-08-10 11:25       ` Stefano Stabellini
2015-08-10 11:25         ` Stefano Stabellini
2015-08-10 11:32         ` Julien Grall
2015-08-10 11:32         ` [Xen-devel] " Julien Grall
2015-08-10 11:32           ` Julien Grall
2015-08-10 12:41           ` David Vrabel
2015-08-10 12:41           ` [Xen-devel] " David Vrabel
2015-08-10 12:41             ` David Vrabel
2015-08-10 11:25       ` Stefano Stabellini
2015-08-07 16:46 ` [PATCH v3 10/20] xen/xenbus: Use Xen page definition Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 11/20] tty/hvc: xen: Use xen " Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-20  9:55   ` [Xen-devel] " David Vrabel
2015-08-20  9:55     ` David Vrabel
2015-08-28 15:03     ` Julien Grall
2015-08-28 15:03     ` [Xen-devel] " Julien Grall
2015-08-28 15:03       ` Julien Grall
2015-08-20  9:55   ` David Vrabel
2015-08-07 16:46 ` [PATCH v3 12/20] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 11:18   ` Stefano Stabellini
2015-08-10 11:18     ` Stefano Stabellini
2015-08-10 11:31     ` Julien Grall
2015-08-10 11:31       ` Julien Grall
2015-08-10 12:55       ` Stefano Stabellini
2015-08-10 12:55         ` Stefano Stabellini
2015-08-10 13:36         ` Julien Grall
2015-08-10 13:36           ` Julien Grall
2015-08-10 13:36         ` Julien Grall
2015-08-10 12:55       ` Stefano Stabellini
2015-08-10 11:31     ` Julien Grall
2015-08-10 11:18   ` Stefano Stabellini
2015-08-20  9:59   ` David Vrabel
2015-08-20  9:59   ` [Xen-devel] " David Vrabel
2015-08-20  9:59     ` David Vrabel
2015-08-28 15:10     ` Julien Grall
2015-08-28 15:10     ` [Xen-devel] " Julien Grall
2015-08-28 15:10       ` Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 13/20] xen/events: fifo: Make it running on 64KB granularity Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 14/20] xen/grant-table: " Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 15/20] block/xen-blkfront: Make it running on 64KB page granularity Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-20  8:10   ` Roger Pau Monné
2015-08-20  8:10     ` Roger Pau Monné
2015-08-28 15:33     ` Julien Grall
2015-08-28 15:33       ` Julien Grall
2015-08-28 15:33     ` Julien Grall
2015-08-20  8:10   ` Roger Pau Monné
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 16/20] block/xen-blkback: " Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-20  8:14   ` Roger Pau Monné
2015-08-20  8:14     ` Roger Pau Monné
2015-08-20  8:14   ` Roger Pau Monné
2015-08-07 16:46 ` [PATCH v3 17/20] net/xen-netfront: " Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-20 10:03   ` [Xen-devel] " David Vrabel
2015-08-20 10:03     ` David Vrabel
2015-08-20 10:03   ` David Vrabel
2015-08-07 16:46 ` [PATCH v3 18/20] net/xen-netback: " Julien Grall
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-08 14:55   ` Wei Liu
2015-08-08 14:55     ` Wei Liu
2015-08-10  9:57     ` Julien Grall
2015-08-10  9:57     ` Julien Grall [this message]
2015-08-10  9:57       ` Julien Grall
2015-08-10 11:39       ` Wei Liu
2015-08-10 11:39         ` Wei Liu
2015-08-10 12:00         ` Julien Grall
2015-08-10 12:00           ` Julien Grall
2015-08-10 12:00         ` Julien Grall
2015-08-10 11:39       ` Wei Liu
2015-08-08 14:55   ` Wei Liu
2015-08-07 16:46 ` [PATCH v3 19/20] xen/privcmd: Add support for Linux " Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 12:03   ` Stefano Stabellini
2015-08-10 12:03     ` Stefano Stabellini
2015-08-10 12:14     ` David Vrabel
2015-08-10 12:14     ` [Xen-devel] " David Vrabel
2015-08-10 12:14       ` David Vrabel
2015-08-10 12:57       ` Stefano Stabellini
2015-08-10 12:57       ` [Xen-devel] " Stefano Stabellini
2015-08-10 12:57         ` Stefano Stabellini
2015-08-10 13:25         ` Julien Grall
2015-08-10 13:25           ` Julien Grall
2015-08-10 13:25         ` Julien Grall
2015-09-01 17:10     ` Julien Grall
2015-09-01 17:10       ` Julien Grall
2015-09-01 17:10     ` Julien Grall
2015-08-10 12:03   ` Stefano Stabellini
2015-08-20 10:08   ` [Xen-devel] " David Vrabel
2015-08-20 10:08     ` David Vrabel
2015-08-20 10:08   ` David Vrabel
2015-08-07 16:46 ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 20/20] arm/xen: Add support for " Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-07 16:46   ` Julien Grall
2015-08-10 12:52   ` Stefano Stabellini
2015-08-10 12:52   ` Stefano Stabellini
2015-08-10 12:52     ` Stefano Stabellini
2015-08-07 17:11 ` [PATCH v3 00/20] xen/arm64: Add support for 64KB page Julien Grall
2015-08-07 17:11 ` [Xen-devel] " Julien Grall
2015-08-07 17:11   ` Julien Grall
2015-08-20  0:40 ` Julien Grall
2015-08-20  0:40 ` [Xen-devel] " Julien Grall
2015-08-20  0:40   ` Julien Grall
2015-08-20  8:15   ` Roger Pau Monné
2015-08-20  8:15     ` Roger Pau Monné
2015-08-20  8:15   ` Roger Pau Monné
2015-08-20 10:11   ` [Xen-devel] " David Vrabel
2015-08-20 10:11     ` David Vrabel
2015-08-20 15:03     ` Julien Grall
2015-08-20 15:03       ` Julien Grall
2015-08-20 15:15       ` David Vrabel
2015-08-20 15:15         ` David Vrabel
2015-08-20 15:15       ` David Vrabel
2015-08-20 15:03     ` Julien Grall
2015-08-20 10:11   ` David Vrabel

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=55C8759C.3010507@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.