From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 10/10] xen/swiotlb: Depending on after_bootmem is not correct.
Date: Mon, 17 Sep 2012 15:52:20 +0100 [thread overview]
Message-ID: <alpine.DEB.2.02.1209171550570.29232@kaball.uk.xensource.com> (raw)
In-Reply-To: <20120917142315.GA12541@phenom.dumpdata.com>
On Mon, 17 Sep 2012, Konrad Rzeszutek Wilk wrote:
> > > start_dma_addr = xen_virt_to_bus(xen_io_tlb_start);
> > > - if (!after_bootmem)
> > > + rc = 0;
> > ^
> > why does this change belong to this patch?
> >
> >
>
> I took that out of the this patch, so it is now:
>
>
> >From c5bc5502abc0f70b682c0f2a70d08e6319825163 Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Wed, 5 Sep 2012 13:35:47 -0400
> Subject: [PATCH 1/2] xen/swiotlb: Depending on after_bootmem is not correct.
>
> When PCI IOMMUs are initialized it is after after_bootmem but
> before a lot of "other" subsystems are initialized. As such
> the check for after_bootmem is incorrect and we should
> just use a parameter to define whether we are early or late.
Given that the after_bootmem checks are introduced by patch 6/10, I
would just merge the two.
In any case, it looks OK now.
> This solves this bootup problem:
>
> __ex_table already sorted, skipping sortM
> Initializing CPU#0
> Warning: only able to allocate 1 MB for software IO TLB
> Xen-SWIOTLB: Lowering to 2MB
> Warning: only able to allocate 1 MB for software IO TLB
> Xen-SWIOTLB: Lowering to 2MB
> Warning: only able to allocate 1 MB for software IO TLB
> Xen-SWIOTLB: Lowering to 2MB
> Warning: only able to allocate 1 MB for software IO TLB
> Cannot allocate Xen-SWIOTLB buffer (rc:-12)
>
> [v1: Had rc=0 in it by mistake]
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> arch/x86/xen/pci-swiotlb-xen.c | 4 ++--
> drivers/xen/swiotlb-xen.c | 10 +++++-----
> include/xen/swiotlb-xen.h | 2 +-
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c
> index fc0c78f..1608244 100644
> --- a/arch/x86/xen/pci-swiotlb-xen.c
> +++ b/arch/x86/xen/pci-swiotlb-xen.c
> @@ -69,7 +69,7 @@ int __init pci_xen_swiotlb_detect(void)
> void __init pci_xen_swiotlb_init(void)
> {
> if (xen_swiotlb) {
> - xen_swiotlb_init(1);
> + xen_swiotlb_init(1, true /* early */);
> dma_ops = &xen_swiotlb_dma_ops;
>
> /* Make sure ACS will be enabled */
> @@ -84,7 +84,7 @@ int pci_xen_swiotlb_init_late(void)
> if (xen_swiotlb)
> return 0;
>
> - rc = xen_swiotlb_init(1);
> + rc = xen_swiotlb_init(1, false /* late */);
> if (rc)
> return rc;
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 6f81994..02a52f3 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -176,7 +176,7 @@ static const char *xen_swiotlb_error(enum xen_swiotlb_err err)
> }
> return "";
> }
> -int __ref xen_swiotlb_init(int verbose)
> +int __ref xen_swiotlb_init(int verbose, bool early)
> {
> unsigned long bytes, order;
> int rc = -ENOMEM;
> @@ -190,7 +190,7 @@ retry:
> /*
> * Get IO TLB memory from any location.
> */
> - if (!after_bootmem)
> + if (early)
> xen_io_tlb_start = alloc_bootmem_pages(PAGE_ALIGN(bytes));
> else {
> #define SLABS_PER_PAGE (1 << (PAGE_SHIFT - IO_TLB_SHIFT))
> @@ -220,7 +220,7 @@ retry:
> bytes,
> xen_io_tlb_nslabs);
> if (rc) {
> - if (!after_bootmem)
> + if (early)
> free_bootmem(__pa(xen_io_tlb_start), PAGE_ALIGN(bytes));
> else {
> free_pages((unsigned long)xen_io_tlb_start, order);
> @@ -230,7 +230,7 @@ retry:
> goto error;
> }
> start_dma_addr = xen_virt_to_bus(xen_io_tlb_start);
> - if (!after_bootmem)
> + if (early)
> swiotlb_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs, verbose);
> else
> rc = swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs);
> @@ -244,7 +244,7 @@ error:
> goto retry;
> }
> pr_err("%s (rc:%d)", xen_swiotlb_error(m_ret), rc);
> - if (!after_bootmem)
> + if (early)
> panic("%s (rc:%d)", xen_swiotlb_error(m_ret), rc);
> else
> free_pages((unsigned long)xen_io_tlb_start, order);
> diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
> index a0db2b7..de8bcc6 100644
> --- a/include/xen/swiotlb-xen.h
> +++ b/include/xen/swiotlb-xen.h
> @@ -3,7 +3,7 @@
>
> #include <linux/swiotlb.h>
>
> -extern int xen_swiotlb_init(int verbose);
> +extern int xen_swiotlb_init(int verbose, bool early);
>
> extern void
> *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
> --
> 1.7.7.6
>
next prev parent reply other threads:[~2012-09-17 14:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-10 19:45 [PATCH] Xen-SWIOTLB fixes (v4) for v3.7 Konrad Rzeszutek Wilk
2012-09-10 19:45 ` [PATCH 01/10] xen/swiotlb: Simplify the logic Konrad Rzeszutek Wilk
2012-09-10 19:45 ` [PATCH 02/10] xen/swiotlb: With more than 4GB on 64-bit, disable the native SWIOTLB Konrad Rzeszutek Wilk
2012-09-10 19:46 ` [PATCH 03/10] swiotlb: add the late swiotlb initialization function with iotlb memory Konrad Rzeszutek Wilk
2012-09-10 19:46 ` [PATCH 04/10] xen/swiotlb: Move the nr_tbl determination in its own function Konrad Rzeszutek Wilk
2012-09-14 16:08 ` Stefano Stabellini
2012-09-10 19:46 ` [PATCH 05/10] xen/swiotlb: Move the error strings to " Konrad Rzeszutek Wilk
2012-09-14 16:00 ` Stefano Stabellini
2012-09-10 19:46 ` [PATCH 06/10] xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used Konrad Rzeszutek Wilk
2012-09-14 16:26 ` Stefano Stabellini
2012-09-10 19:46 ` [PATCH 07/10] xen/pcifront: Use Xen-SWIOTLB when initting if required Konrad Rzeszutek Wilk
2012-09-10 19:46 ` [PATCH 08/10] xen/swiotlb: Remove functions not needed anymore Konrad Rzeszutek Wilk
2012-09-14 16:06 ` Stefano Stabellini
2012-09-14 17:06 ` Konrad Rzeszutek Wilk
2012-09-17 10:52 ` Stefano Stabellini
2012-09-10 19:46 ` [PATCH 09/10] xen/swiotlb: Fix compile warnings when using plain integer instead of NULL pointer Konrad Rzeszutek Wilk
2012-09-14 16:11 ` Stefano Stabellini
2012-09-10 19:46 ` [PATCH 10/10] xen/swiotlb: Depending on after_bootmem is not correct Konrad Rzeszutek Wilk
2012-09-14 16:10 ` Stefano Stabellini
2012-09-14 17:09 ` Konrad Rzeszutek Wilk
2012-09-17 14:23 ` Konrad Rzeszutek Wilk
2012-09-17 14:25 ` Is: [PATCH 11/10] xen/swiotlb: For early initialization, return zero on success. Was: " Konrad Rzeszutek Wilk
2012-09-17 14:53 ` Stefano Stabellini
2012-09-17 14:52 ` Stefano Stabellini [this message]
2012-09-17 17:02 ` Konrad Rzeszutek Wilk
[not found] ` <m2n.s.1TBAAE-152299@chiark.greenend.org.uk>
2012-09-13 15:53 ` [Xen-devel] [PATCH 09/10] xen/swiotlb: Fix compile warnings when using plain integer instead of NULL pointer Ian Jackson
2012-09-13 15:56 ` Ian Jackson
2012-09-13 16:00 ` Ian Jackson
2012-09-22 13:28 ` [Xen-devel] [PATCH] Xen-SWIOTLB fixes (v4) for v3.7 Konrad Rzeszutek Wilk
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=alpine.DEB.2.02.1209171550570.29232@kaball.uk.xensource.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.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).