Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp481020rdb; Tue, 5 Dec 2023 10:28:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgX/fN9sNd86kLMSVCbj/Qw6UxWsWTu2cS6LDnSGlLEZfeuG4jUfWVc+YiUPYpJ8idcsxu X-Received: by 2002:a05:6358:d03:b0:170:5499:9a5d with SMTP id v3-20020a0563580d0300b0017054999a5dmr890836rwj.54.1701800918103; Tue, 05 Dec 2023 10:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701800918; cv=none; d=google.com; s=arc-20160816; b=MqlMoyGwRTv2lDv6SwxRjlWaX/QUiC+xFTRfeL1T8oatIqzgaxTqvWJHqr+LiYdrvW /hR0hPtO4acTAOwJzK/0q/UVk9aoC9K/71UuFwdkSdqvvMR9dsOkcNiHKnw8whRXlNDv osGE5GZyNptH4yj11VzzG8wpQZSZVsjICoV2O9Qfnc4kwqTa16y+eJhxY+QOWUwS1TDs aU4fN6eTKP/ROTW5ctkIgZlpsyv3tB5ipAZ74yRDKS1MgUrMIQ7YXuRiB/plgcs84rf4 IuXqjLQd5ut0z0263g4i/SZII36Lo9sah9zGdFCwuXjpuOwGnh0rTtJFl5qfZMWPp9RD KXig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=nSzVzIo4FwkV2Vz1YTXopis8lr6Srl5Uq43ou9xzPfQ=; fh=jiUwy+yVz+VJOhXkmoAapeHCkfbrr7FhpTrimbjL0w8=; b=qlUMoeqgdlGeYw4hpG2HntgRs7wSLW2o/zcyeq1FKOXoc90Hln5PPENXbmKbwTBFhs 5kkFPCEnd9+jBkmPeon/6KhGFy4X3wyRjIBDapqKN5QwgctjR3G9zzC2ItvIVI9cSp6g zM+W5H8A1mfJaZ1Pp58Us9R0za4FMM3h2IFjmyLoFa16zvSQuraAqxPTR5oUPaA2q3c5 984zx+QZGUfp3LJMJpO3Z0YmGrfTX8TL08LsleMVM3TS/z9bdqreOFolL7gv+u28c7ir x0NdBFYwPa7L7+7C1LksHJUxq7R/gC/IcAdZuHpZZxU1bsj+Jg2BoBt/gV7wGej1dDIp lFAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bx42-20020a056a02052a00b005b8eacb29c1si5660039pgb.437.2023.12.05.10.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:28:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9C8348056C67; Tue, 5 Dec 2023 10:28:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346145AbjLES2U (ORCPT + 99 others); Tue, 5 Dec 2023 13:28:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbjLES2R (ORCPT ); Tue, 5 Dec 2023 13:28:17 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id D666C1A5 for ; Tue, 5 Dec 2023 10:28:23 -0800 (PST) Received: (qmail 425898 invoked by uid 1000); 5 Dec 2023 13:28:23 -0500 Date: Tue, 5 Dec 2023 13:28:23 -0500 From: Alan Stern To: Catalin Marinas Cc: Ferry Toth , Ferry Toth , Christoph Hellwig , Hamza Mahfooz , Dan Williams , Marek Szyprowski , Andrew , Andy Shevchenko , Thorsten Leemhuis , iommu@lists.linux.dev, Kernel development list , USB mailing list , Robin Murphy , Will Deacon Subject: Re: Bug in add_dma_entry()'s debugging code Message-ID: References: <20231127160759.GA1668@lst.de> <637d6dff-de56-4815-a15a-1afccde073f0@rowland.harvard.edu> <20231128133702.GA9917@lst.de> <76e8def2-ff45-47d3-91ab-96876ea84079@gmail.com> <5425cf42-0f49-41b5-b26d-1e099d5bdcc2@elsinga.info> <5093ce37-047e-4aa8-a9e8-2978da9d734a@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 10:28:35 -0800 (PST) On Fri, Dec 01, 2023 at 05:42:52PM +0000, Catalin Marinas wrote: > Indeed, so to be sure we don't trip over other false alarms, we'd also > need to force ARCH_DMA_MINALIGN to be at least a cache-line size. That's > used in some structures to force a static alignment of various members > that take DMA transfers. After that, anything reported might actually be > a potential issue, not a false alarm. > > However, I wonder whether we'd actually hide some genuine problems. > Let's say x86 gets some DMA corruption when it tries to DMA 8 bytes > into two adjacent buffers because of some DMA buffer overflow, nothing > to do with cache lines. You enable the DMA API debugging to see if it > reports anything and it suddenly starts working because of the forced > minimum alignment. In the long run, it may turn out that trying to detect memory usage patterns that could cause problems for architectures other than the one currently running is not workable. Certainly it is a bad idea to have a debugging infrastructure that changes the behavior of other parts of the system -- particularly when those other parts may be the ones you're trying to debug. You may end up needing to make a choice here. Which evil is lesser? Alan Stern