Message ID | 20240125-mmc-no-blk-bounce-high-v1-1-d0f92a30e085@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1505538dyi; Thu, 25 Jan 2024 00:56:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhd4tKxrV0YX9sBo4+VOwACONQRROd2KCmAYgqbbQWwU6Zj1kFuzxWt6QBrw5hHBzgvBN0 X-Received: by 2002:a17:906:ba83:b0:a31:8705:5ae1 with SMTP id cu3-20020a170906ba8300b00a3187055ae1mr228498ejd.80.1706172998295; Thu, 25 Jan 2024 00:56:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706172998; cv=pass; d=google.com; s=arc-20160816; b=l286De9XxswQphyky1Zs1uVMRt5F6xtNiFgeDQl+1SyqHyfhw6h6uZxtw45PliX7Ly aq+tAPFMk3vT8yusuoh9Rd5RMuRWd+sdZ+7P/QYWH3JmbFXBH60z1vhZ0/Eindtk9sl+ Pa39WhG0oNhG4bIqY0kEBqVtlxMypHJosOp0sjMzmFVbraLJ722cJvcok0+RK1ELo/LX w33q6dca2t2cx5z9rOo7JPxbSriOK2nLQ0J6CIDb9GLntVzw4O2w9jbOX6OLGLwFvumm z2LCmOkPiAB1zO74GrpBPRe9rswlNJNISQF7yEKxRQqaix7y5+wPb55r+oYimaYk6oO1 96Og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=9nzIZ26hgws2/hotMw7rC6A6aDLu0kuLVowyhBFtTbQ=; fh=kyzSCZjKUn0nQ6lpJazaUwXmR923KQ5Er6c6nnnupfM=; b=gWk7KQE2o87MJLjt64TkfkplbqfScX7BYMpIUgUo28ipZiM3U8f+OLPgtLNOpMFCyR gkI0YqNLmx9OB5979ys0gRIsPWLf05i3S38biMxRPTm6Iga53ce7oTGBLnNP73A6iPY4 INm8W1+LJX0GQOFrQM4b1KR0Mi+LgnQh7QneqSuI6r5VqXJ3WcDLOtdyZc0wjavgZ+Lk T9YX4QuOhr1nZPeZ+8otme60VQDz/ic0Ct1y0+boT9hGk1tJdjnQSTGMnypBij8FDfO6 Z+p2w0pRVn6VTzEJroqwPiEws33ELmOo/5lRl0QuTCOPngGRvmoo30KVnXydmSPul3AI Bn/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M7k6wnvA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lg9-20020a170906f88900b00a30e90371b5si760018ejb.591.2024.01.25.00.56.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 00:56:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M7k6wnvA; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38194-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6A6371F29E44 for <ouuuleilei@gmail.com>; Thu, 25 Jan 2024 08:50:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FC331B970; Thu, 25 Jan 2024 08:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="M7k6wnvA" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E1F71B948 for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 08:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706172628; cv=none; b=VrRLorGWVAASHXl5n0u9KIrj5L2GCZlHVT8j1kiQELrVtNrB/XYU6bMH0Ud2AUQnBx0Q9ygKtYdlEqEW7Yw3P2Py07Jkm9b8JkGcioLmqua0c70Xdc+HO4kTZgPkJALn5yres0dK29qgyO+cx6LOlv357LtotEGKQkVIQOHvdhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706172628; c=relaxed/simple; bh=EH+77AGVJlszAEz96TBhp+qKRmGjcsF5K96WCfJ8o8I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=gmsf9kpEPCH18NngOofXYoZqL1sldmE9DhM4lQtE3zorkUGoGzycLAS/JUz+e42GWGEYfc8IzHmLcGGH3leeJy/oOhzOBtOAKrg75ZS0swpTElvk45X9+sAlLjYbjQgFRp9U4WSgDrifLd8Zgm/aNUOd7QGPSXs04W5O+iZaBsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=M7k6wnvA; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50edf4f478eso8492617e87.3 for <linux-kernel@vger.kernel.org>; Thu, 25 Jan 2024 00:50:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706172624; x=1706777424; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=9nzIZ26hgws2/hotMw7rC6A6aDLu0kuLVowyhBFtTbQ=; b=M7k6wnvAPH8H2FZTR0S0qE1xM49BOh2/xL5+jjzcRufqlzb9pZ7If9Kw6SECA3VvzU /bp9r0+D0xIS+UEEM21K4auvqHADzAmXJ/FHHbIB0ZHyv+tKeskARgDmwC6Jm3cAiFgm ofnYXVfjbMlX9tM+ECfeUEWm1Ce5sQgOetTa4ia7RiCTcoZxOlOa+c6iQUTSnOdW9dON a/O36/5ISThtaZF9/NFKxD5qm+yQl2Vj1yj3NOcOzWlyBqCYNWg7FfVvJsdxl2CyXsUg Es2+Yfalzg6WTWYdbQbzxxnzelvBq713ib6kBhGoKRyPcqUw2mVdoM3+cOuK1CtmKKbp Jr6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706172624; x=1706777424; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9nzIZ26hgws2/hotMw7rC6A6aDLu0kuLVowyhBFtTbQ=; b=QTdKwGgI+Io6FXm55ePf0JkkcgREDGMbNx6pqxe44VqxcMb5bpjJ7ai2A5a4npqOT7 svkXb0rQjhW3ly26CerJmGv5UWwXFPKAmz42L0jT/fJ7ot3xXas2AtzfuE6yU0y2nvO3 rSrjGe5h8QqX/gBuoDiNwEGVKIHfiGWcKo+edjR//wXAA6Aallzc2vNiQYRSpS86MrAe eGN0sWEQeIGf3e7F2Lu2mM5NOxeGCnOMHoNa40kQjTIX81thBYs3RzQXxhdJLJxkPlMs 9AQC/yKCQ0dpiyOh039pWaYUG38d01mBzqPNX6CnmZR1PBDceE6Gwxi9/iDUGFijMX0u rm7w== X-Gm-Message-State: AOJu0YxoxdHXZiY+YnEK/LKW8eGpT92Fq99/eorsYIc7T/2CGCZcm7Rl UVgzYos23AABrPhlpcnhjnhVvJhkPmbKqdV0FEhy0Koo6L2gMss4FV3dIojj5lM= X-Received: by 2002:a19:8c1e:0:b0:50e:7a04:2229 with SMTP id o30-20020a198c1e000000b0050e7a042229mr356615lfd.25.1706172624565; Thu, 25 Jan 2024 00:50:24 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a6-20020a194f46000000b00510189e1581sm201522lfk.249.2024.01.25.00.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 00:50:24 -0800 (PST) From: Linus Walleij <linus.walleij@linaro.org> Date: Thu, 25 Jan 2024 09:50:23 +0100 Subject: [PATCH] mmc: core Drop BLK_BOUNCE_HIGH Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240125-mmc-no-blk-bounce-high-v1-1-d0f92a30e085@linaro.org> X-B4-Tracking: v=1; b=H4sIAM4gsmUC/x3MQQqAIBBA0avErBswEbKuEi3KJh1KDaUIorsnL d/i/wcyJaYMffVAooszx1DQ1BUYNwVLyEsxSCGVaKRC7w2GiPO+4RzPYAgdW4eLVqR1p00rWij xkWjl+x8P4/t+a5/YAGgAAAA= To: Arnd Bergmann <arnd@arndb.de>, Christoph Hellwig <hch@lst.de>, Ulf Hansson <ulf.hansson@linaro.org> Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org> X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789052057783903199 X-GMAIL-MSGID: 1789052057783903199 |
Series |
mmc: core Drop BLK_BOUNCE_HIGH
|
|
Commit Message
Linus Walleij
Jan. 25, 2024, 8:50 a.m. UTC
The MMC core sets BLK_BOUNCE_HIGH for devices where dma_mask
is unassigned.
For the majority of MMC hosts this path is never taken: the
OF core will unconditionally assign a 32-bit mask to any
OF device, and most MMC hosts are probed from device tree,
see drivers/of/platform.c:
of_platform_device_create_pdata()
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
if (!dev->dev.dma_mask)
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
of_amba_device_create()
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
MMC devices that are probed from ACPI or PCI will likewise
have a proper dma_mask assigned.
The only remaining devices that could have a blank dma_mask
are platform devices instantiated from board files.
These are mostly used on systems without CONFIG_HIGHMEM
enabled which means the block layer will not bounce, and in
the few cases where it is enabled it is not used anyway:
for example some OMAP2 systems such as Nokia n800/n810 will
create a platform_device and not assign a dma_mask, however
they do not have any highmem, so no bouncing will happen
anyway: the block core checks if max_low_pfn >= max_pfn
and this will always be false.
Should it turn out there is a platform_device with blank
DMA mask actually using CONFIG_HIGHMEM somewhere out there
we should set dma_mask for it, not do this trickery.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mmc/core/queue.c | 2 --
1 file changed, 2 deletions(-)
---
base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
change-id: 20240124-mmc-no-blk-bounce-high-d84e8898c707
Best regards,
Comments
On Thu, Jan 25, 2024, at 09:50, Linus Walleij wrote: > The MMC core sets BLK_BOUNCE_HIGH for devices where dma_mask > is unassigned. > > For the majority of MMC hosts this path is never taken: the > OF core will unconditionally assign a 32-bit mask to any > OF device, and most MMC hosts are probed from device tree, > see drivers/of/platform.c: > > of_platform_device_create_pdata() > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > if (!dev->dev.dma_mask) > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > of_amba_device_create() > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > MMC devices that are probed from ACPI or PCI will likewise > have a proper dma_mask assigned. > > The only remaining devices that could have a blank dma_mask > are platform devices instantiated from board files. > > These are mostly used on systems without CONFIG_HIGHMEM > enabled which means the block layer will not bounce, and in > the few cases where it is enabled it is not used anyway: > for example some OMAP2 systems such as Nokia n800/n810 will > create a platform_device and not assign a dma_mask, however > they do not have any highmem, so no bouncing will happen > anyway: the block core checks if max_low_pfn >= max_pfn > and this will always be false. > > Should it turn out there is a platform_device with blank > DMA mask actually using CONFIG_HIGHMEM somewhere out there > we should set dma_mask for it, not do this trickery. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> I think it's worth mentioning the cb710 example here, which uses a platform device as a child of a PCI device and does not assign a DMA mask nor use DMA. This one will see a change in behavior, meaning that the blockdev buffers are no longer bounced. As far as I can tell, this is fine because the driver appears to correctly use the sg_iter infrastructure for mapping data pages, but it would be good to have this confirmed by Michał Mirosław because this code path has probably never been tested without BLK_BOUNCE_HIGH. Adding Michał to Cc. Arnd
From the block POV: awesome,
Acked-by: Christoph Hellwig <hch@lst.de>
On Thu, 25 Jan 2024 at 09:50, Linus Walleij <linus.walleij@linaro.org> wrote: > > The MMC core sets BLK_BOUNCE_HIGH for devices where dma_mask > is unassigned. > > For the majority of MMC hosts this path is never taken: the > OF core will unconditionally assign a 32-bit mask to any > OF device, and most MMC hosts are probed from device tree, > see drivers/of/platform.c: > > of_platform_device_create_pdata() > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > if (!dev->dev.dma_mask) > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > of_amba_device_create() > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > MMC devices that are probed from ACPI or PCI will likewise > have a proper dma_mask assigned. > > The only remaining devices that could have a blank dma_mask > are platform devices instantiated from board files. > > These are mostly used on systems without CONFIG_HIGHMEM > enabled which means the block layer will not bounce, and in > the few cases where it is enabled it is not used anyway: > for example some OMAP2 systems such as Nokia n800/n810 will > create a platform_device and not assign a dma_mask, however > they do not have any highmem, so no bouncing will happen > anyway: the block core checks if max_low_pfn >= max_pfn > and this will always be false. > > Should it turn out there is a platform_device with blank > DMA mask actually using CONFIG_HIGHMEM somewhere out there > we should set dma_mask for it, not do this trickery. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/core/queue.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c > index a0a2412f62a7..316415588a77 100644 > --- a/drivers/mmc/core/queue.c > +++ b/drivers/mmc/core/queue.c > @@ -351,8 +351,6 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) > if (mmc_can_erase(card)) > mmc_queue_setup_discard(mq->queue, card); > > - if (!mmc_dev(host)->dma_mask || !*mmc_dev(host)->dma_mask) > - blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_HIGH); > blk_queue_max_hw_sectors(mq->queue, > min(host->max_blk_count, host->max_req_size / 512)); > if (host->can_dma_map_merge) > > --- > base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d > change-id: 20240124-mmc-no-blk-bounce-high-d84e8898c707 > > Best regards, > -- > Linus Walleij <linus.walleij@linaro.org> >
On Thu, Jan 25, 2024 at 10:47:26AM +0100, Arnd Bergmann wrote: > On Thu, Jan 25, 2024, at 09:50, Linus Walleij wrote: > > The MMC core sets BLK_BOUNCE_HIGH for devices where dma_mask > > is unassigned. > > > > For the majority of MMC hosts this path is never taken: the > > OF core will unconditionally assign a 32-bit mask to any > > OF device, and most MMC hosts are probed from device tree, > > see drivers/of/platform.c: > > > > of_platform_device_create_pdata() > > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > > if (!dev->dev.dma_mask) > > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > > > of_amba_device_create() > > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > > dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > > > MMC devices that are probed from ACPI or PCI will likewise > > have a proper dma_mask assigned. > > > > The only remaining devices that could have a blank dma_mask > > are platform devices instantiated from board files. > > > > These are mostly used on systems without CONFIG_HIGHMEM > > enabled which means the block layer will not bounce, and in > > the few cases where it is enabled it is not used anyway: > > for example some OMAP2 systems such as Nokia n800/n810 will > > create a platform_device and not assign a dma_mask, however > > they do not have any highmem, so no bouncing will happen > > anyway: the block core checks if max_low_pfn >= max_pfn > > and this will always be false. > > > > Should it turn out there is a platform_device with blank > > DMA mask actually using CONFIG_HIGHMEM somewhere out there > > we should set dma_mask for it, not do this trickery. > > > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > > Acked-by: Arnd Bergmann <arnd@arndb.de> > > I think it's worth mentioning the cb710 example here, which > uses a platform device as a child of a PCI device and > does not assign a DMA mask nor use DMA. > > This one will see a change in behavior, meaning that the > blockdev buffers are no longer bounced. As far as I can > tell, this is fine because the driver appears to correctly > use the sg_iter infrastructure for mapping data pages, > but it would be good to have this confirmed by > Michał Mirosław because this code path has probably never > been tested without BLK_BOUNCE_HIGH. Hi, this driver doesn't do DMA at all, so having DMA mask set or not it should be good as long as the CPU can read/write the buffers. Best Regards Michał Mirosław
On Fri, Feb 9, 2024 at 11:35 PM Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote: > > I think it's worth mentioning the cb710 example here, which > > uses a platform device as a child of a PCI device and > > does not assign a DMA mask nor use DMA. > > > > This one will see a change in behavior, meaning that the > > blockdev buffers are no longer bounced. As far as I can > > tell, this is fine because the driver appears to correctly > > use the sg_iter infrastructure for mapping data pages, > > but it would be good to have this confirmed by > > Michał Mirosław because this code path has probably never > > been tested without BLK_BOUNCE_HIGH. > > Hi, this driver doesn't do DMA at all, so having DMA mask set or not > it should be good as long as the CPU can read/write the buffers. The only difference is where the CPU have to read/write the buffers really, before the change those were all guaranteed to be in lowmem (bounced there by the block core), now they can also be in highmem, but sg_miter will deal with it for sure. Yours, Linus Wallej
On Sat, Feb 10, 2024, at 00:41, Linus Walleij wrote: > On Fri, Feb 9, 2024 at 11:35 PM Michał Mirosław <mirq-linux@rere.qmqm.pl> wrote: > >> > I think it's worth mentioning the cb710 example here, which >> > uses a platform device as a child of a PCI device and >> > does not assign a DMA mask nor use DMA. >> > >> > This one will see a change in behavior, meaning that the >> > blockdev buffers are no longer bounced. As far as I can >> > tell, this is fine because the driver appears to correctly >> > use the sg_iter infrastructure for mapping data pages, >> > but it would be good to have this confirmed by >> > Michał Mirosław because this code path has probably never >> > been tested without BLK_BOUNCE_HIGH. >> >> Hi, this driver doesn't do DMA at all, so having DMA mask set or not >> it should be good as long as the CPU can read/write the buffers. > > The only difference is where the CPU have to read/write the > buffers really, before the change those were all guaranteed to > be in lowmem (bounced there by the block core), now they can > also be in highmem, but sg_miter will deal with it for sure. Yes, that was my point: The sg_miter() code is meant to handle exactly this case with highmem data, but as far as I can tell, that code path has never been tested on 32-bit systems with highmem but without BLK_BOUNCE_HIGH. Arnd
On Sat, Feb 10, 2024 at 12:58 PM Arnd Bergmann <arnd@arndb.de> wrote: > On Sat, Feb 10, 2024, at 00:41, Linus Walleij wrote: > > The only difference is where the CPU have to read/write the > > buffers really, before the change those were all guaranteed to > > be in lowmem (bounced there by the block core), now they can > > also be in highmem, but sg_miter will deal with it for sure. > > Yes, that was my point: The sg_miter() code is meant to > handle exactly this case with highmem data, but as far > as I can tell, that code path has never been tested on > 32-bit systems with highmem but without BLK_BOUNCE_HIGH. It's actually possible to enforce testing of highmem scatterlists to an MMC card (one need to be careful as this is destructive testing!) drivers/mmc/core/mmc_test.c ..but the one relevant target I have is a Kirkwood and it only has 128 MB of memory so highmem won't be exercised. I'll put this into the cover letter on the other series (fixing a bunch of drivers to use sg_miter) though. Yours, Linus Walleij
On Sat, Feb 10, 2024, at 20:38, Linus Walleij wrote: > On Sat, Feb 10, 2024 at 12:58 PM Arnd Bergmann <arnd@arndb.de> wrote: >> On Sat, Feb 10, 2024, at 00:41, Linus Walleij wrote: > >> > The only difference is where the CPU have to read/write the >> > buffers really, before the change those were all guaranteed to >> > be in lowmem (bounced there by the block core), now they can >> > also be in highmem, but sg_miter will deal with it for sure. >> >> Yes, that was my point: The sg_miter() code is meant to >> handle exactly this case with highmem data, but as far >> as I can tell, that code path has never been tested on >> 32-bit systems with highmem but without BLK_BOUNCE_HIGH. > > It's actually possible to enforce testing of highmem scatterlists > to an MMC card (one need to be careful as this is destructive > testing!) > drivers/mmc/core/mmc_test.c > > ...but the one relevant target I have is a Kirkwood and it only > has 128 MB of memory so highmem won't be exercised. I think you can pass a vmalloc= command line option to the kernel that will increase the size of the vmalloc are at the expense of lowmem and give you some highmem instead. Arnd
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index a0a2412f62a7..316415588a77 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -351,8 +351,6 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) if (mmc_can_erase(card)) mmc_queue_setup_discard(mq->queue, card); - if (!mmc_dev(host)->dma_mask || !*mmc_dev(host)->dma_mask) - blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_HIGH); blk_queue_max_hw_sectors(mq->queue, min(host->max_blk_count, host->max_req_size / 512)); if (host->can_dma_map_merge)