From patchwork Thu Nov 6 11:46:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 40276 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9953C2404A for ; Thu, 6 Nov 2014 11:58:32 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf2039550eek.7 for ; Thu, 06 Nov 2014 03:58:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:in-reply-to:message-id :references:user-agent:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=vGi29fIcni/SI64xQZyrrrETi5UbtLPfr028pqnIiyU=; b=DF9eDaKyn7pTBdNLPvg5m00R4bNlUUhloSm2g3112kFM3MW84unJskTUgIqFm5Rbvl ApIAX8iLV9aiKfBKZqSHhvm6ma59FgqvdB3aUN6PNbalPuqMrSXZ6YUy/hKcCXfHO+wq J7Yy6OdmTKKe4wxHD4eicYfoaJ5oOi4X4YyupwNG1Q6BwJihFT6zEWBFhqE6BeWLXrT+ gGi0U9pZ/s69Pp7lqLq8Tk1QCgkm6oEyjPTZWnAO3+bcWYOL3RM2h6EtehoGFC1zyn3M zO5CnHszANvFbrPvtReZLi2ppjpCkPmsaGw1zFUQkwsMidR+etj6G5QudcnOeEct/2If LpXA== X-Gm-Message-State: ALoCoQnFDAYwfW+s8Zl0Vmj6dpGMTW3rngPFsiF8VBpsolFljX162Fisx53T2aSz2fXniN9LZLue X-Received: by 10.180.221.7 with SMTP id qa7mr1347132wic.6.1415275111901; Thu, 06 Nov 2014 03:58:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.2 with SMTP id e2ls61029lab.88.gmail; Thu, 06 Nov 2014 03:58:31 -0800 (PST) X-Received: by 10.153.11.133 with SMTP id ei5mr4538659lad.75.1415275111678; Thu, 06 Nov 2014 03:58:31 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id r3si11054316lar.133.2014.11.06.03.58.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 03:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id 10so769565lbg.14 for ; Thu, 06 Nov 2014 03:58:31 -0800 (PST) X-Received: by 10.152.42.226 with SMTP id r2mr4577197lal.29.1415275111586; Thu, 06 Nov 2014 03:58:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp32129lbc; Thu, 6 Nov 2014 03:58:30 -0800 (PST) X-Received: by 10.140.104.200 with SMTP id a66mr5663272qgf.37.1415275110189; Thu, 06 Nov 2014 03:58:30 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p2si11352368qah.109.2014.11.06.03.58.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 03:58:30 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XmLgK-0004tK-At; Thu, 06 Nov 2014 11:56:52 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XmLgJ-0004t8-7y for xen-devel@lists.xen.org; Thu, 06 Nov 2014 11:56:51 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id 5B/B9-02702-2026B545; Thu, 06 Nov 2014 11:56:50 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1415275008!11807433!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10563 invoked from network); 6 Nov 2014 11:56:49 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 6 Nov 2014 11:56:49 -0000 X-IronPort-AV: E=Sophos;i="5.07,325,1413244800"; d="scan'208";a="190132722" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Thu, 6 Nov 2014 06:56:47 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XmLWs-0005Hf-LE; Thu, 06 Nov 2014 11:47:06 +0000 Date: Thu, 6 Nov 2014 11:46:58 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: Julien Grall In-Reply-To: <545A5F1F.9030006@linaro.org> Message-ID: References: <545A5F1F.9030006@linaro.org> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-DLP: MIA1 Cc: xen-devel , Ian Campbell , Stefano Stabellini Subject: Re: [Xen-devel] xen/arm: kernel BUG at /local/home/julien/works/linux/drivers/xen/swiotlb-xen.c:102 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Hello Julien, I didn't manage to reproduce the issue you are seeing but I think you are right: non-LPAE kernels could get in trouble by calling xen_bus_to_phys. This problem is not ARM specific per se, but it doesn't occur on x86 because config XEN depends on X86_32 && X86_PAE. The following patch should fix the issue: On Wed, 5 Nov 2014, Julien Grall wrote: > Hi Stefano, > > I've tried your patch series [1] "introduce GNTTABOP_cache_flush" > on midway with non-LPAE (i.e short descriptor) kernel. > > While your series should fix the cache flush on this kind of kernel, > I'm still hitting a BUG_ON when I boot a guest (see stack trace [2]). > > >From a quick look this is because the dma and physical address don't have > the same size (resp. 64 and 32 bits). Technically xen_bus_to_phys doesn't really > have a meaning on Xen ARM: the address is still a DMA address but we cast it to > a physical address (not sure why?). > > It occurs when I use the multi_v7 config (+ XEN) as DOM0. Disabling CONFIG_LPAE > in the config should also do the job. > > Regards, > > [1] https://lkml.org/lkml/2014/10/27/441 > > [2] Stack trace: > > [ 98.092290] dma 0x2b6769000 paddr 0xb6769000 > [ 98.096475] ------------[ cut here ]------------ > [ 98.101147] kernel BUG at /local/home/julien/works/linux/drivers/xen/swiotlb-xen.c:102! > [ 98.109219] Internal error: Oops - BUG: 0 [#1] SMP ARM > [ 98.114427] Modules linked in: > [ 98.117554] CPU: 3 PID: 48 Comm: irq/115-highban Not tainted 3.18.0-rc3-00051-g93cf079-dirty #231 > [ 98.126493] task: db281680 ti: db40e000 task.ti: db40e000 > [ 98.131965] PC is at xen_unmap_single+0xc4/0xc8 > [ 98.136563] LR is at xen_unmap_single+0xc4/0xc8 > [ 98.141162] pc : [] lr : [] psr: 60000013 > [ 98.141162] sp : db40fdf0 ip : 00000000 fp : b6769000 > [ 98.152793] r10: 00000200 r9 : 00000002 r8 : 00000002 > [ 98.158088] r7 : 00000000 r6 : 002b6769 r5 : 00000002 r4 : b6769000 > [ 98.164693] r3 : 00000753 r2 : 1af49000 r1 : dbbc73bc r0 : 00000020 > [ 98.171282] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel > [ 98.178660] Control: 10c5387d Table: 39e3c06a DAC: 00000015 > [ 98.184475] Process irq/115-highban (pid: 48, stack limit = 0xdb40e250) > [ 98.191159] Stack: (0xdb40fdf0 to 0xdb410000) > [ 98.195586] fde0: b6769000 00000020 00000000 00000002 > [ 98.203833] fe00: db40fe00 db0ea210 00000000 d98a1a80 00000001 00000001 00000002 db0ea210 > [ 98.212079] fe20: 00000000 db3e3410 db3f1790 c04d1880 00000200 00000002 00000000 00000016 > [ 98.220325] fe40: 0000091e db4100b8 d98a1a80 db410000 00000001 000000b0 00000001 c05cdddc > [ 98.228570] fe60: 00000000 c0262f9c db08c01c db281680 db40e010 db4100b8 db410000 db4116c8 > [ 98.236817] fe80: 00000001 c05ce0b0 00000000 00000000 db410000 c05ce478 db410000 db4116c8 > [ 98.245068] fea0: 00000000 db410000 e0880100 00000008 00000000 e0880000 00000001 c05e5288 > [ 98.253309] fec0: c0c8a994 db40fee8 e0804000 c020897c c041c868 60000013 ffffffff 00000000 > [ 98.261554] fee0: db3f1890 0000001f 00000073 00000001 db3f1890 c02836ac db00f7d4 c05e57d0 > [ 98.269801] ff00: c05e5788 db3f6340 db00f780 00000000 00000001 db00f780 db3f6340 c02836c8 > [ 98.278047] ff20: db3f6360 db40e000 00000000 c02839ec c02838b4 db40e030 00000000 c02837f8 > [ 98.286293] ff40: 00000000 db3f6380 00000000 db3f6340 c02838b4 00000000 00000000 00000000 > [ 98.294538] ff60: 00000000 c0262358 00000000 00000000 00000000 db3f6340 00000000 00000000 > [ 98.302785] ff80: db40ff80 db40ff80 00000000 00000000 db40ff90 db40ff90 db40ffac db3f6380 > [ 98.311031] ffa0: c0262280 00000000 00000000 c020f278 00000000 00000000 00000000 00000000 > [ 98.319276] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > [ 98.327522] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 > [ 98.335780] [] (xen_unmap_single) from [] (xen_swiotlb_unmap_sg_attrs+0x48/0x68) > [ 98.344974] [] (xen_swiotlb_unmap_sg_attrs) from [] (ata_sg_clean+0x8c/0x120) > [ 98.353912] [] (ata_sg_clean) from [] (__ata_qc_complete+0x34/0x144) > [ 98.362071] [] (__ata_qc_complete) from [] (ata_qc_complete_multiple+0xa0/0xd4) > [ 98.371194] [] (ata_qc_complete_multiple) from [] (ahci_port_thread_fn+0x138/0x638) > [ 98.380649] [] (ahci_port_thread_fn) from [] (ahci_thread_fn+0x48/0x90) > [ 98.389067] [] (ahci_thread_fn) from [] (irq_thread_fn+0x1c/0x40) > [ 98.396970] [] (irq_thread_fn) from [] (irq_thread+0x138/0x174) > [ 98.404693] [] (irq_thread) from [] (kthread+0xd8/0xf0) > [ 98.411723] [] (kthread) from [] (ret_from_fork+0x14/0x3c) > [ 98.419011] Code: e1a02004 e1a03005 e34c00ad eb0f9c9a (e7f001f2) > > -- > Julien Grall > diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index ac5d41b..489620d 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -96,8 +96,6 @@ static inline phys_addr_t xen_bus_to_phys(dma_addr_t baddr) dma_addr_t dma = (dma_addr_t)pfn << PAGE_SHIFT; phys_addr_t paddr = dma; - BUG_ON(paddr != dma); /* truncation has occurred, should never happen */ - paddr |= baddr & ~PAGE_MASK; return paddr; @@ -449,7 +447,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, BUG_ON(dir == DMA_NONE); - xen_dma_unmap_page(hwdev, paddr, size, dir, attrs); + xen_dma_unmap_page(hwdev, dev_addr, size, dir, attrs); /* NOTE: We use dev_addr here, not paddr! */ if (is_xen_swiotlb_buffer(dev_addr)) {