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 2FFCEC25B78 for ; Tue, 4 Jun 2024 20:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pSQfj2CpoXJzbgfGVvQFKbihgOQmwq4Z1xGlZOEDboc=; b=yFnoOMtkZUeAQj qArmdr6phTBRZqYT7pNZScUnvb59l0hhxRJrD78PUKO90rJQqPRyjh+hPGL3tIFdqi3Dt31VGpXEI hyDj77ReZST23atGJGoERKbaCdD+8Yb+Z4Xy6X6ovvBJ0LjdXmaO6013vyYKqGEY8M78eVOOAaW8h dFDGDFvJnjib0rqxt6cGX/RMddykAW47to5bAtxETlMTmdarlUlOBFl2nMmdo55OZsXGM2+iqXShj QlujYy0dIbUPnZqc3JupRyt8GBAgSv4I11Gsh3Lk98pDtgnFpA4Mj5Zd8BlqZNHkzq15pvkReTBau oS+C8mlxDbqMK4aiI/xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEaWg-00000003h3H-0oXj; Tue, 04 Jun 2024 20:12:58 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sEaWc-00000003h2P-1df6 for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 20:12:56 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6f938a7f492so686479a34.1 for ; Tue, 04 Jun 2024 13:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1717531972; x=1718136772; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gPaAJ0jtH4HyBQSxs+rTYBBrfJz43nBGIYL4UfuFVr0=; b=Tci4iyf8+DEdXkt+p/5h01m+jDFazg6p38PJJzODXZ1jSrTI3pyl+/j3ImYciYh78O G/aTqfkRqP2e7+RrLryGKmEFR+TQU9oS1uc2Dww6JEROFFlGbYJvn3RRBcrh/qMLYTEC PYc9qdPq1QOSjH1ga5LQKq23bRU2VkeTOlRXOpDbweX9HbNQ7jMKhsg4zRTHKyvxoTFG ftH+Yth6YP5tyJ2mgJ3OlVUqQXQOgy6c22QZqEoZ5nPOGnbNr5S0nKfQ4mRI+nOP2n8F sXSxJ3vGXI78Y/PaFD4D/ohswitovBs47QvuIICaLAvkP7PqcN3DMH+ahxw8EyR22vNb q+YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717531972; x=1718136772; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gPaAJ0jtH4HyBQSxs+rTYBBrfJz43nBGIYL4UfuFVr0=; b=VoAsgPXnv0UcmwUW565d1BPD1H4jLNd2KLfWmAS+OaLfQMx8BW97rC4ISFHoJNCKL+ CPh0je76mR0JA9jijnAly30OUHGzyFj36MiieOSI5I2AHoeFDOes1XyIJbDSWJWbjT38 DYtgzc/Cn2zCCFm7pvE5FWv6wRRzDI19bKa/cukKPq2qKR07JmGKeoeDPuORqtU87HZd KKCcA66SKPt6di3NPN6XJJ1NvgZjb9FAuu84v1Ekchmr156llC5FQtwRHUXrJyCfEYxi nhaB3Lu1q8xI4MUUvKlps/QSPbHkJOu/8TsvGrHvduyEB5SDnLqeD/NA8tREhlbF1Aom j4cg== X-Forwarded-Encrypted: i=1; AJvYcCWzkYZbqGnIRnqX/IN+0+xwTukWAOSHLCJfur+HXRAisUbBaa1LfWG0iiN+kvk7Tm4Bjv3cmwb3osOJ1OdalYdPbz84JC3YwdZO7LELTjiVEzjnlaM= X-Gm-Message-State: AOJu0YzKt/9dMaLJyvQZdHOKoAEuGvRqF238V/5BLk7GckNhobwd1etw ouCr1/FWIZy3CRiYyenpEXWVxQ0+ylt84qO1H0QCu4ePgCGngKXBp0Ry5NplvI6atPiw69KRZ3j 9zhU= X-Google-Smtp-Source: AGHT+IFZwZZeQOvP5e77QrYZrErAjCh8kMGCHbtmCyz6Y6ByuoVRY4Tf8uQzpMtkcs3LdVR+s7ty4g== X-Received: by 2002:a05:6870:1711:b0:24c:4f80:a59b with SMTP id 586e51a60fabf-2512229c384mr611586fac.58.1717531972436; Tue, 04 Jun 2024 13:12:52 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id af79cd13be357-794fd5e68f1sm306946985a.110.2024.06.04.13.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 13:12:52 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1sEaWZ-003LSw-EE; Tue, 04 Jun 2024 17:12:51 -0300 Date: Tue, 4 Jun 2024 17:12:51 -0300 From: Jason Gunthorpe To: Will Deacon Cc: Arnd Bergmann , Catalin Marinas , Arnd Bergmann , Baoquan He , Kefeng Wang , Peter Zijlstra , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v2] arm64/io: add constant-argument check Message-ID: <20240604201251.GA791043@ziepe.ca> References: <20240528153717.2439910-1-arnd@kernel.org> <20240604155536.GA20674@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240604155536.GA20674@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240604_131254_466161_056696F1 X-CRM114-Status: GOOD ( 29.66 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 04, 2024 at 04:55:37PM +0100, Will Deacon wrote: > On Tue, May 28, 2024 at 05:37:11PM +0200, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > In some configurations __const_iowrite32_copy() does not get inlined > > and gcc runs into the BUILD_BUG(): > > > > In file included from : > > In function '__const_memcpy_toio_aligned32', > > inlined from '__const_iowrite32_copy' at arch/arm64/include/asm/io.h:203:3, > > inlined from '__const_iowrite32_copy' at arch/arm64/include/asm/io.h:199:20: > > include/linux/compiler_types.h:487:45: error: call to '__compiletime_assert_538' declared with attribute error: BUILD_BUG failed > > 487 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > | ^ > > include/linux/compiler_types.h:468:25: note: in definition of macro '__compiletime_assert' > > 468 | prefix ## suffix(); \ > > | ^~~~~~ > > include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert' > > 487 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) > > | ^~~~~~~~~~~~~~~~~~~ > > include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' > > 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) > > | ^~~~~~~~~~~~~~~~~~ > > include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG' > > 59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed") > > | ^~~~~~~~~~~~~~~~ > > arch/arm64/include/asm/io.h:193:17: note: in expansion of macro 'BUILD_BUG' > > 193 | BUILD_BUG(); > > | ^~~~~~~~~ > > > > Move the check for constant arguments into the inline function to ensure > > it is still constant if the compiler decides against inlining it. > > > > Fixes: ead79118dae6 ("arm64/io: Provide a WC friendly __iowriteXX_copy()") > > Signed-off-by: Arnd Bergmann > > --- > > v2: > > - fix both 32-bit and 64-bit copies > > - remove now-redundant macros > > --- > > arch/arm64/include/asm/io.h | 24 +++++++++--------------- > > 1 file changed, 9 insertions(+), 15 deletions(-) > > I think this is superseded by Mark's diff in reply to v1, right? > > https://lore.kernel.org/r/ZlcODqVXTDh6n0h-@J2N7QTR9R3 > > If so, Mark, please can you post that as a proper patch so that we can > get this fixed? I wouldn't say superseded, but I agree with Mark that we should have the __always_inline added to the __iowrite64_copy() and __const_memcpy_toio_aligned64() in addition to the stuff here. When I originally wrote this I copied the fairly common pattern of having the builtin_constant_p test inside a macro, but I see now it is quite common to put that into an inline. Putting it in the inline is definately much better, so I like Arnd's patch. Arnd can you just make that addition and repost this? Thanks, Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel