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 71AB4D37487 for ; Thu, 17 Oct 2024 13:01:09 +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=uxZ8zRDQJT8AwJwuhReUV3OmU+i9cuOOJMkmttbiBF0=; b=3RciSD1E+PjlHJ5Z+/VGY8/Sq1 vQ7j1LO8ghNe6eFmOZk4CyWDVdqssW/h0vVBoX/Uk1nL8yycNZCuQBZzY3KspNbGPLG+AEOxlC2Ly SO6let1J1NlmfA/cRvbBahTkl56ChvXRbjqdMzoK8Xp10z2AWwqGfc/4RqK+Rrb2YP8iA5Z1Bk4DM X61cfhA0RXKkwWOEru+0PmXktw+iqtgqCnB8LNmjkKMA0pPpmbm5UEkMr/We+lmgcwNqJt2FlFJnR fPjLMtEOGiybBT/x4+9gH4TA1BErWh7CSqPRunfAW8nr/GeRNJcA8qttRxHxkE3Xytxo1KzZpsKlw lj5Ss9lQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Q7c-0000000Er2A-1y1N; Thu, 17 Oct 2024 13:00:56 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1PyS-0000000EprH-0guH for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 12:51:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 29CF45C41A4; Thu, 17 Oct 2024 12:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED8B7C4CEC3; Thu, 17 Oct 2024 12:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729169487; bh=5j15eT918xydVxHdlScuM8Z8O1RXoSCieKuyjdyfJhU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LC8oarjHlSAF5pidioTEz8bPBwH15OVtGZKJXtxJ95e3svqFYRi99yxVF/A8zkL5y DjEEcdVyKfl501O+clX8U8go8BtRfxD4WhFIm8g3NU/ABRdzFi6+21IMEnB5IlfDtQ oi+vSqPM/cMFPcCpe1DUy3UqoxALq7pcnaFNEHSkXqFnKjgId5RmGd05Wv3ZlkmMbH Qc6Kh3a0wHqlQNa2iCJ+tvD9IC/z+WR4bbOUmghaHKP+jACoq6Yt33nW4b3wGU192q ZC4FBPEDnkLi0rTQhAVKBdKtKuhMyrcvSXgCeQxKHL+rO/PotoV6iJ7FvWFvVqlCIe M+uqlEKscUoVg== Date: Thu, 17 Oct 2024 14:51:20 +0200 From: Niklas Cassel To: Ryan Roberts Cc: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , Damien Le Moal , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Kees Cook , "Gustavo A. R. Silva" Subject: Re: [RFC PATCH v1 34/57] sata_sil24: Remove PAGE_SIZE compile-time constant assumption Message-ID: References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> <20241014105912.3207374-34-ryan.roberts@arm.com> <7aa84080-6845-496a-a394-30d334632298@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7aa84080-6845-496a-a394-30d334632298@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_055128_269139_362C54C8 X-CRM114-Status: GOOD ( 19.22 ) 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, Oct 17, 2024 at 01:42:22PM +0100, Ryan Roberts wrote: > On 17/10/2024 10:09, Niklas Cassel wrote: (snip) > > As you might know, there is an effort to annotate all flexible array > > members with their run-time size information, see commit: > > dd06e72e68bc ("Compiler Attributes: Add __counted_by macro") > > I'm vaguely aware of it. But as I understand it, __counted_by() nominates > another member in the struct which keeps the count? In this case, there is no > such member, it's size is implicit based on the value of PAGE_SIZE. So I'm not > sure if it's practical to use it here? Neither am I :) Perhaps some of the flexible array member experts like Kees Cook or Gustavo A. R. Silva could help us out here. Would it make sense to add another struct member and simply initialize it to PAGE_SIZE, in order to be able to use the __counted_by macro? > > > > > I haven't looked at the DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST macro, but since > > DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), when doing a boot-time page size build, > defers the initialization of the global variable to kernel init time, when > PAGE_SIZE is known. Because SIL24_MAX_SGE is defined in terms of PAGE_SIZE, this > deferral is required. > > > sge[] now becomes a flexible array member, I think it would be nice if it > > would be possible to somehow use the __counted_by macro. > >