From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28396C3A5A2 for ; Tue, 3 Sep 2019 11:49:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC93D2087E for ; Tue, 3 Sep 2019 11:49:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="itOqg9WY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC93D2087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZiI/bQ991Jj6zB+kvRUaCOoxEmo4E9uxY4RcM9FyweE=; b=itOqg9WYcaNajvL2xcFF9Mbdh mv8AtK4RY0swsmmzDR32vz7TVYWtxg5D/Y5gCR30tZz5JsZ4wp+thHLMSO4RU0W0QMpA2osJ7KUDH 0dVSN+j2KaY8zEm/eBQMZuFeFczNe6NXuy9W52bIyAraogwKnlyhXhMHsQcAT+5hxMtnhpwihwecY w+C9dp0vRTlAtY2YbQ2tUP9uO1Fnb4S1Y9UyRQs1XXkyFIKLtlXOPj6KWWFgGgqEC6inRAwuxnO/l f4y9w6Bck1un4ZMYzkFe6PASbQgBbpgu8Z6nSHGITTDAcgYhaymbSfCc+JGfZOqxA/A/W6wUrBddX pAmKLABCQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i57J1-00018P-1K; Tue, 03 Sep 2019 11:49:03 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i57Ix-00015I-QZ for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2019 11:49:01 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9715BAF68; Tue, 3 Sep 2019 11:48:34 +0000 (UTC) Subject: Re: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64 To: Christoph Hellwig , Stefano Stabellini References: <1567175255-1798-1-git-send-email-peng.fan@nxp.com> <20190830085807.GA15771@infradead.org> <20190902155732.GA8311@infradead.org> From: Juergen Gross Message-ID: <8e81051f-ad50-7b4e-2e88-c685ade6b240@suse.com> Date: Tue, 3 Sep 2019 13:48:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190902155732.GA8311@infradead.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190903_044900_009273_E8D8697B X-CRM114-Status: GOOD ( 19.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , "will@kernel.org" , Catalin Marinas , "linux@armlinux.org.uk" , Julien Grall , dl-linux-imx , "xen-devel@lists.xenproject.org" , boris.ostrovsky@oracle.com, nd , Robin Murphy , "linux-arm-kernel@lists.infradead.org" Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 02.09.19 17:57, Christoph Hellwig wrote: > On Fri, Aug 30, 2019 at 07:40:42PM -0700, Stefano Stabellini wrote: >> + Juergen, Boris >> >> On Fri, 30 Aug 2019, Christoph Hellwig wrote: >>> Can we take a step back and figure out what we want to do here? >>> >>> AFAICS this function allocates memory for the swiotlb-xen buffer, >>> and that means it must be <= 32-bit addressable to satisfy the DMA API >>> guarantees. That means we generally want to use GFP_DMA32 everywhere >>> that exists, but on systems with odd zones we might want to dip into >>> GFP_DMA. This also means swiotlb-xen doesn't actually do the right >>> thing on x86 at the moment. So shouldn't we just have one common >>> routine in swiotlb-xen.c that checks if we have CONFIG_ZONE_DMA32 >>> set, then try GFP_DMA32, and if not check if CONFIG_ZONE_DMA is set >>> and then try that, else default to GFP_KERNEL? >> >> Yes, for ARM/ARM64 it makes a lot of sense given that dom0 is 1:1 mapped >> (pseudo-physical == physical). I'll let Juergen and Boris comment on >> the x86 side of things, but on x86 PV Dom0 is not 1:1 mapped so >> GFP_DMA32 is probably not meaningful. > > But is it actually harmful? If the GFP_DMA32 doesn't hurt we could > just use it there. Or if that seems to ugly we can make the dma > flags dependents on a XEN_1TO1_MAPPED config option set by arm/arm64. > I'd rather have it only if needed. Especially on X86 PV dom0 I'd like to avoid GFP_DMA32 as memory below 4GB (guest physical) might be rather scarce in some configurations. I think X86 PVH dom0 should need GFP_DMA32, too, as the limit is related to the address as communicated to the device (before being translated by the IOMMU), right? This would mean on a X86 kernel configured to support PV and PVH the test for setting GFP_DMA32 can't depend on a config option alone, it needs to be dynamic. BTW, for PV guests the DMA address width is handled via xen_create_contiguous_region(). Juergen _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel