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 9CACEC3DA64 for ; Thu, 1 Aug 2024 01:25:29 +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=WSiG/Q5Lv6qtCFb+dbQkFV/cQccAtM/Xdyfn/Pmio5E=; b=rZWjQbSUX7zhtU7aoG+q/r/43+ EdqUyysudWInNBwPIi1/06uWa32LuPj90+WE42DM8HlVFIc3u/4sTyPFyjo36Lj5B/r7oEv/Nm2gg xVCGr0wJcD4nUqJlGfMqqwsC0hQnhxvNwjSs95rEB66mlstTcH7rxNW5u/aUAzH6lSwNjyE3zYDMN 0G9REnLnMoqxr76jzK6FBpD6GTvlQoYSs7/PGSpO8hqkDn4eBB75Rvpgassgb06VY/RhVRjg/bo3Z hDPLJNEjc1E6g7mKzVnAAuSbZoHWbjcL66n5LDa0d0ZnXvXlOyrGEccQIjchl/LhAncJlcSUF5YSj sRd4JncQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZKZ6-00000003Dki-031a; Thu, 01 Aug 2024 01:25:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZKYe-00000003Dh6-2BnW for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Aug 2024 01:24:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=WSiG/Q5Lv6qtCFb+dbQkFV/cQccAtM/Xdyfn/Pmio5E=; b=Y4s5iLzmxgpyB0rw9+83iH5iTA Zz/mVf3TjH+2hzBNXn1Ht8T7oH2PaAx7P2TpcyoPsB/7b7fDE8j9Xip80YkE/y3Pa/Psb6OiD3HHg vVUmPu3L7WWIAznVvECCqRKM+gZTp1RcD4Nfd1V1R+9Y14qPlAf7mdiu3B6M+ayhlP7Y5/s8DTuHc z61vVUGv0Rm3UKpZnqNA3EviseOrosdb30Ol5MOK+7HxQ4yid3mj5HmSPzsFYzAtB/r699CFA0TU8 XW0wwwE1DWir72h7piGRyjmkxEQDnJNQn3A7Ebv28h7XoKvj9PMk2j37lXmJBJtPJMsIJQ2tuoFfy 56lRtCQA==; Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZKYW-00000005Ksd-0Xjo for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 01:24:42 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C1F11CE17FD; Thu, 1 Aug 2024 01:24:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FD22C116B1; Thu, 1 Aug 2024 01:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722475467; bh=Pgpqo4RtxVJ1ue8DwjL2l0l2UL9ejI31ZTKHWsBrk4Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XVZIR7ZCGTG0w41hQSmLUNL6cZMuc0xp588STEletZW6rGg2Zw5ATIgyJNDcnVReb B3EfWzjWskItTFqdGEFqKaNkyGttT9TLBlQWyu/w8Tuxs0k3bHkwZd0cu+hd+HJiBM TLWeLNnPzjvU1idP/yzgeefl8ZzJqv2fdNIoFW2QL9yRXpPiUWdGcYIxH9/tq99yFQ xlNDkZrz9RPWiLvSDiSFXG1SG7k6RBe2KkK8hixvDn+6BA8ozx+ajPaXfsgWLA8nel 7BEThuYora+MdjBceQZNxXOF5muIGxkG3oYUZNn0HCWNcoz+pncWSlk+9RsOGJ4U29 oEus3plyggpmg== Date: Wed, 31 Jul 2024 18:24:24 -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: <20240801012424.GA1640480@thelio-3990X> References: <053fa4806a2c63efcde80caca473a8b670a2701c.1722249878.git.baruch@tkos.co.il> <202407300338.oaUo6jtB-lkp@intel.com> <20240730021208.GA8272@thelio-3990X> <20240730153450.GA30021@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240730153450.GA30021@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_022436_879053_FCA0047E X-CRM114-Status: GOOD ( 22.82 ) 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 Tue, Jul 30, 2024 at 05:34:50PM +0200, Christoph Hellwig wrote: > On Mon, Jul 29, 2024 at 07:12:08PM -0700, Nathan Chancellor wrote: > > > | ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~ > > > include/linux/dma-mapping.h:77:40: note: expanded from macro 'DMA_BIT_MASK' > > > 77 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) > > > | ^~~~~ > > > 2 warnings generated. > > > > FWIW, this is likely a false positive due to an issue in Clang with the > > control flow graph for global variables: > > > > https://github.com/ClangBuiltLinux/linux/issues/92 > > > > DMA_BIT_MASK() has been the biggest offender :/ If there is any way to > > refactor this code to avoid this, that would be great (as that has been > > one of our longest outstanding issues and getting it fixed in the > > compiler does not seem super easy at this point). > > I have no idea what you'd want changed here, but I'll happily take > patches. 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); +__diag_pop(); static inline dma_addr_t phys_to_dma_direct(struct device *dev, phys_addr_t phys)