linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: <linux-arm-kernel@lists.infradead.org>, <ian.campbell@citrix.com>,
	<stefano.stabellini@eu.citrix.com>,
	<linux-kernel@vger.kernel.org>,
	"Julien Grall" <julien.grall@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Russell King <linux@arm.linux.org.uk>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH v3 14/20] xen/grant-table: Make it running on 64KB granularity
Date: Fri, 7 Aug 2015 17:46:53 +0100	[thread overview]
Message-ID: <1438966019-19322-15-git-send-email-julien.grall@citrix.com> (raw)
In-Reply-To: <1438966019-19322-1-git-send-email-julien.grall@citrix.com>

The Xen interface is using 4KB page granularity. This means that each
grant is 4KB.

The current implementation allocates a Linux page per grant. On Linux
using 64KB page granularity, only the first 4KB of the page will be
used.

We could decrease the memory wasted by sharing the page with multiple
grant. It will require some care with the {Set,Clear}ForeignPage macro.

Note that no changes has been made in the x86 code because both Linux
and Xen will only use 4KB page granularity.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>

    Changes in v3:
        - Add Stefano's reviewed-by

    Changes in v2
        - Add David's reviewed-by
---
 arch/arm/xen/p2m.c        | 6 +++---
 drivers/xen/grant-table.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index 887596c..0ed01f2 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -93,8 +93,8 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
 	for (i = 0; i < count; i++) {
 		if (map_ops[i].status)
 			continue;
-		set_phys_to_machine(map_ops[i].host_addr >> PAGE_SHIFT,
-				    map_ops[i].dev_bus_addr >> PAGE_SHIFT);
+		set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
+				    map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT);
 	}
 
 	return 0;
@@ -108,7 +108,7 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
 	int i;
 
 	for (i = 0; i < count; i++) {
-		set_phys_to_machine(unmap_ops[i].host_addr >> PAGE_SHIFT,
+		set_phys_to_machine(unmap_ops[i].host_addr >> XEN_PAGE_SHIFT,
 				    INVALID_P2M_ENTRY);
 	}
 
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 94ae0fd..253d4db 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -642,7 +642,7 @@ int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
 	if (xen_auto_xlat_grant_frames.count)
 		return -EINVAL;
 
-	vaddr = xen_remap(addr, PAGE_SIZE * max_nr_gframes);
+	vaddr = xen_remap(addr, XEN_PAGE_SIZE * max_nr_gframes);
 	if (vaddr == NULL) {
 		pr_warn("Failed to ioremap gnttab share frames (addr=%pa)!\n",
 			&addr);
@@ -654,7 +654,7 @@ int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
 		return -ENOMEM;
 	}
 	for (i = 0; i < max_nr_gframes; i++)
-		pfn[i] = PFN_DOWN(addr) + i;
+		pfn[i] = XEN_PFN_DOWN(addr) + i;
 
 	xen_auto_xlat_grant_frames.vaddr = vaddr;
 	xen_auto_xlat_grant_frames.pfn = pfn;
@@ -1004,7 +1004,7 @@ static void gnttab_request_version(void)
 {
 	/* Only version 1 is used, which will always be available. */
 	grant_table_version = 1;
-	grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1);
+	grefs_per_grant_frame = XEN_PAGE_SIZE / sizeof(struct grant_entry_v1);
 	gnttab_interface = &gnttab_v1_ops;
 
 	pr_info("Grant tables using version %d layout\n", grant_table_version);
-- 
2.1.4


  parent reply	other threads:[~2015-08-07 17:15 UTC|newest]

Thread overview: 63+ 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 ` [PATCH v3 01/20] net/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop Julien Grall
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-10 10:10   ` Stefano Stabellini
2015-08-07 16:46 ` [PATCH v3 03/20] xen: Add Xen specific page definition Julien Grall
2015-08-10 10:46   ` Stefano Stabellini
2015-08-20  9:49   ` [Xen-devel] " 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-10 10:44   ` Stefano Stabellini
2015-08-20  9:51   ` [Xen-devel] " David Vrabel
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 ` [PATCH v3 06/20] block/xen-blkfront: Split blkif_queue_request in 2 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 ` [PATCH v3 08/20] block/xen-blkfront: split get_grant in 2 Julien Grall
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-10 10:50   ` Stefano Stabellini
2015-08-10 11:24     ` [Xen-devel] " Julien Grall
2015-08-10 11:25       ` Stefano Stabellini
2015-08-10 11:32         ` Julien Grall
2015-08-10 12:41           ` David Vrabel
2015-08-07 16:46 ` [PATCH v3 10/20] xen/xenbus: Use Xen page definition Julien Grall
2015-08-07 16:46 ` [PATCH v3 11/20] tty/hvc: xen: Use xen " Julien Grall
2015-08-20  9:55   ` [Xen-devel] " David Vrabel
2015-08-28 15:03     ` Julien Grall
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-10 11:18   ` Stefano Stabellini
2015-08-10 11:31     ` Julien Grall
2015-08-10 12:55       ` Stefano Stabellini
2015-08-10 13:36         ` Julien Grall
2015-08-20  9:59   ` [Xen-devel] " David Vrabel
2015-08-28 15:10     ` 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 [this message]
2015-08-07 16:46 ` [PATCH v3 15/20] block/xen-blkfront: Make it running on 64KB page granularity Julien Grall
2015-08-20  8:10   ` Roger Pau Monné
2015-08-28 15:33     ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 16/20] block/xen-blkback: " Julien Grall
2015-08-20  8:14   ` Roger Pau Monné
2015-08-07 16:46 ` [PATCH v3 17/20] net/xen-netfront: " Julien Grall
2015-08-20 10:03   ` [Xen-devel] " David Vrabel
2015-08-07 16:46 ` [PATCH v3 18/20] net/xen-netback: " Julien Grall
2015-08-08 14:55   ` Wei Liu
2015-08-10  9:57     ` Julien Grall
2015-08-10 11:39       ` Wei Liu
2015-08-10 12:00         ` Julien Grall
2015-08-07 16:46 ` [PATCH v3 19/20] xen/privcmd: Add support for Linux " Julien Grall
2015-08-10 12:03   ` Stefano Stabellini
2015-08-10 12:14     ` [Xen-devel] " David Vrabel
2015-08-10 12:57       ` Stefano Stabellini
2015-08-10 13:25         ` Julien Grall
2015-09-01 17:10     ` Julien Grall
2015-08-20 10:08   ` [Xen-devel] " David Vrabel
2015-08-07 16:46 ` [PATCH v3 20/20] arm/xen: Add support for " Julien Grall
2015-08-10 12:52   ` Stefano Stabellini
2015-08-07 17:11 ` [Xen-devel] [PATCH v3 00/20] xen/arm64: Add support for 64KB page Julien Grall
2015-08-20  0:40 ` Julien Grall
2015-08-20  8:15   ` Roger Pau Monné
2015-08-20 10:11   ` David Vrabel
2015-08-20 15:03     ` Julien Grall
2015-08-20 15:15       ` 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=1438966019-19322-15-git-send-email-julien.grall@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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 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).