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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4DFE6C3DA4A for ; Thu, 1 Aug 2024 15:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eI9NHB585JheQj1GS3zwyiS/NM3BA9MfSm7RhnE2X+Y=; b=OxtjXTEjKxEyMy8ViVeZahS/Cx JtZqF8RsiFDV00cCsqQGcVXgbUyMymeWjBlsjRblLj5gXZh5T2Gs5yysTyQZ+5JZ2ED9DHCR1c98S MRgcO9V/Odr66z/Qh0bOg25l7fl8l85Bta2SfKxnaQQsmDbam5h0pk2/VZBq6MO270bkVCCDaPoH3 dcajsgN0UWWmhUVyO/kQxVCmGxr6/fjD2FUjKXHMTTzadEI8Y9tJnnN81B4AEcyU9R2r7TaCSRyuL FPmkbg4+YajLTKRRjWiyitvz6L9ONbdQ/2N2rqrJ140bUMWXmjOHccT3UbJkRV/2ViY84X483ibw0 5j43Rmig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZXeK-00000005qhB-3zDD; Thu, 01 Aug 2024 15:23:29 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZXdp-00000005qWt-0C80 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 15:22:59 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 19563628F9; Thu, 1 Aug 2024 15:22:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E072FC32786; Thu, 1 Aug 2024 15:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722525775; bh=MCfSDdIjcHZQ9l663dFR3qY6umGQeR97WyGmOHY9GQc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Knkt0BM+MQksHfY/hnZ5m9c3nrY9foJmh8e9BoyHVve6RRLlCuddPDzrCGNCt/ftL mJF1PBOEm4zuxZ3M4vi/Iql7r+0kclcoSgV9S9lPeNHT6ZcMEgXBv/31FWDFXpO9Qb LgXolyyLaYGMKNhDuoXGyMRYwXifC+krPUjWBUsvb83wmz1H14Vz5okPqc/h8Ia081 +3ol8UNGML6OUyf9IM8ssrnducmo4Qp4OTOssdyBMF37pqAa9Wv7R9XPFa7QB9+a9l 4HzHa7PCR4h177R7pzQ5I1b5muNgo5WbJxJ4fv7jpaXCsxPzGrcizXKCx38obDNCND nUpMq3yjdLwOw== Date: Thu, 1 Aug 2024 08:22:53 -0700 From: Nathan Chancellor To: Christoph Hellwig Cc: kernel test robot , Baruch Siach , Marek Szyprowski , Catalin Marinas , Will Deacon , llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, linux-s390@vger.kernel.org, Ramon Fried , Petr =?utf-8?B?VGVzYcWZw61r?= , Robin Murphy , linux-kernel@vger.kernel.org, iommu@lists.linux.dev, Elad Nachman , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 2/3] dma-mapping: replace zone_dma_bits by zone_dma_limit Message-ID: <20240801152253.GA122261@thelio-3990X> References: <053fa4806a2c63efcde80caca473a8b670a2701c.1722249878.git.baruch@tkos.co.il> <202407300338.oaUo6jtB-lkp@intel.com> <20240730021208.GA8272@thelio-3990X> <20240730153450.GA30021@lst.de> <20240801012424.GA1640480@thelio-3990X> <20240801134454.GB2245@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240801134454.GB2245@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_082257_179372_DB4170A9 X-CRM114-Status: GOOD ( 23.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 01, 2024 at 03:44:54PM +0200, Christoph Hellwig wrote: > On Wed, Jul 31, 2024 at 06:24:24PM -0700, Nathan Chancellor wrote: > > Unfortunately, I am not sure either... I do not see anything obviously, > > so perhaps it could just be avoided with the __diag() infrastructure? > > > > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > > index 3dbc0b89d6fb..b58e7eb9c8f1 100644 > > --- a/kernel/dma/direct.c > > +++ b/kernel/dma/direct.c > > @@ -20,7 +20,12 @@ > > * it for entirely different regions. In that case the arch code needs to > > * override the variable below for dma-direct to work properly. > > */ > > +__diag_push(); > > +__diag_ignore(clang, 13, "-Wconstant-conversion", > > + "Clang incorrectly thinks the n == 64 case in DMA_BIT_MASK() can happen here," > > + "which would truncate with a 32-bit phys_addr_t"); > > phys_addr_t zone_dma_limit __ro_after_init = DMA_BIT_MASK(24); > > So.. The code above is clearly wrong, as DMA_BIT_MASK always returns a > u64, and phys_addr_t can be smaller than that. So at least in this case > the warning seems perfectly valid and the code has issues because it is > mixing different concepts. Sure, that seems like a reasonable way to look at things even if the warning itself is a false positive. > Where do you see warnings like this upstream? I don't see this upstream, this is from patch 2 of this series: https://lore.kernel.org/053fa4806a2c63efcde80caca473a8b670a2701c.1722249878.git.baruch@tkos.co.il/ Cheers, Nathan