Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3015342pxu; Sat, 10 Oct 2020 16:10:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/XFC5o122lNsYnYXYcwaYvUoAGCtf8yyjS4hGOeiYeJiR9rne6Ms973drYoohOso6hG8y X-Received: by 2002:a17:906:7e53:: with SMTP id z19mr21056229ejr.334.1602371458402; Sat, 10 Oct 2020 16:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602371458; cv=none; d=google.com; s=arc-20160816; b=bgG1jPmhzWTpn5NVX6vZzogKl6kc7uAp+/E33fXartNCavHqj8MGPa5zHYw+U5gbrO +8zeg0k0jCKRXMKLZDhkwmYxCtHN6SHMzmhjl732LtCwMT7+BDWXe6WM7b4SBKDVRjID g76XH9c7SzjtH6gYc3Sh/utnxpUt2yui35e7TUVM4Q7TU6V4taMPL+1B0gILGAGpjk+O OB3ROqXXwtz/+1akWOdRI+2uF0r5XzXaLb0Kpx2sffAOc2ZETSfs6maA5uVxyQEuavxP wHTZSvPcPX+/4TKjSeg2gS5Is0EciqbOnuQWt7Tpa8nN0008ANcyeGb04PtIesb1Hf1Z hW1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=p4zb0xRbm4/+KnmI5gEQ0BMwr0ZV4hgMFS4e7DwFffo=; b=I/lZN02D9PanHOsjia+NSFkDf6N0qUfPZWJDma5N5YP/gz/eO64wvp7dgvE12I7Tz8 naGy3R/vxRCKh7QnBuxz8B/tOCCX8rzoxYPK0uR56HpXw26c1LvpsXuB4XSwE6nxofd9 wrU6rMG63vpkhCyrpzXyXK4RUry1jIOU+wHhsiwZ+/tH5coHmSkFC2bbR5xZbB6MuBGg dECPtU5kzsMdp6f0jnry5bTFMrSA+cn/4mYRpLfe6eVTm6MGwgFiixC7SVNG5BWdJO+d 7+BfsuZnDvkPRNqOJhZkg+Hgqjbryzd8gdQcTd0/GvhVZDMqLCctR0drfWXUocEo+sGH T94w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rKy3ckBB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si9767686edp.153.2020.10.10.16.10.35; Sat, 10 Oct 2020 16:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rKy3ckBB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730529AbgJJW7U (ORCPT + 99 others); Sat, 10 Oct 2020 18:59:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731907AbgJJTyP (ORCPT ); Sat, 10 Oct 2020 15:54:15 -0400 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 044D82173E; Sat, 10 Oct 2020 10:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602326202; bh=drBUl94hJDiJbg7EAVxrflroZLL9cGY6sJkpslPiZ5s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rKy3ckBBBgFebn68RQgydnukpiggooqY/F0UdxKn+PD4vBKQFsw9OUH0z/Br8qzHL vqXLEt7HvxX5ixXoMa6fe3GoyAotCaowYAzljQILgN2nuY+ugEd4yxrmWqTA8qruKo /9s7DKu5OmwTNMIx2nhbM/00epBYdkcLbPkrKE5w= Received: by mail-ot1-f53.google.com with SMTP id t15so11384074otk.0; Sat, 10 Oct 2020 03:36:41 -0700 (PDT) X-Gm-Message-State: AOAM531/rG6LPQrqOxjVBKIVhE2Av8dXVvs63RBl0ahzfOuczDXaT0FR x5c2mSSNBIy/Oa+qSD2JbfgRlSYodiryUiaMJl0= X-Received: by 2002:a9d:6a85:: with SMTP id l5mr12561956otq.77.1602326201362; Sat, 10 Oct 2020 03:36:41 -0700 (PDT) MIME-Version: 1.0 References: <20201001172320.GQ21544@gaia> <20201002115541.GC7034@gaia> <12f33d487eabd626db4c07ded5a1447795eed355.camel@suse.de> <20201009071013.GA12208@lst.de> <513833810c15b5efeab7c3cbae1963a78c71a79f.camel@suse.de> <20201009152433.GA19953@e121166-lin.cambridge.arm.com> <20201009171051.GL23638@gaia> In-Reply-To: <20201009171051.GL23638@gaia> From: Ard Biesheuvel Date: Sat, 10 Oct 2020 12:36:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711 To: Catalin Marinas Cc: Lorenzo Pieralisi , Nicolas Saenz Julienne , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Will Deacon , Linux Kernel Mailing List , Linux Memory Management List , iommu@lists.linux-foundation.org, Rob Herring , linux-rpi-kernel@lists.infradead.org, Frank Rowand , Christoph Hellwig , Linux ARM , Robin Murphy Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Oct 2020 at 19:10, Catalin Marinas wrote: > > On Fri, Oct 09, 2020 at 06:23:06PM +0200, Ard Biesheuvel wrote: > > On Fri, 9 Oct 2020 at 17:24, Lorenzo Pieralisi > > wrote: > > > We can move this check to IORT code and call it from arm64 if it > > > can be made to work. > > > > Finding the smallest value in the IORT, and assigning it to > > zone_dma_bits if it is < 32 should be easy. But as I understand it, > > having these separate DMA and DMA32 zones is what breaks kdump, no? So > > how is this going to fix the underlying issue? > > If zone_dma_bits is 32, ZONE_DMA32 disappears into ZONE_DMA (GFP_DMA32 > allocations fall back to ZONE_DMA). > > kdump wants DMA-able memory and, without a 30-bit ZONE_DMA, that would > be the bottom 32-bit. With the introduction of ZONE_DMA, this suddenly > became 1GB. We could change kdump to allocate ZONE_DMA32 but this one > may also be small as it lost 1GB to ZONE_DMA. However, the kdump kernel > would need to be rebuilt without ZONE_DMA since it won't have any. IIRC > (it's been a while since I looked), the kdump allocation couldn't span > multiple zones. > > In a separate thread, we try to fix kdump to use allocations above 4G as > a fallback but this only fixes platforms with enough RAM (and maybe it's > only those platforms that care about kdump). > One thing that strikes me as odd is that we are applying the same shifting logic to ZONE_DMA as we are applying to ZONE_DMA32, i.e., if DRAM starts outside of the zone, it is shifted upwards. On a typical ARM box, this gives me [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000080000000-0x00000000bfffffff] [ 0.000000] DMA32 [mem 0x00000000c0000000-0x00000000ffffffff] [ 0.000000] Normal [mem 0x0000000100000000-0x0000000fffffffff] i.e., the 30-bit addressable range has bit 31 set, which is weird. I wonder if it wouldn't be better (and less problematic in the general case) to drop this logic for ZONE_DMA, and simply let it remain empty unless there is really some memory there.