Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1450417pxb; Sat, 23 Apr 2022 07:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtTP5xYCha3P7saN1EGn5+LK5GYNqDb5HuMJiil2SjquBQlgT68kX5rFcpAJ+pvyzwwKBy X-Received: by 2002:a62:6443:0:b0:50a:d54c:7de2 with SMTP id y64-20020a626443000000b0050ad54c7de2mr10093874pfb.60.1650722618239; Sat, 23 Apr 2022 07:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650722618; cv=none; d=google.com; s=arc-20160816; b=pSq7Y7mtNpaUjndrKoibZZ33NHh5cigK261B6ehOZNKSMxvq7SUB3bFz21GU1NVZFG NsmXiMDUZ1mm+DkRjLI0LbSssUSc1LSRqna6FRRUxuWCAmFlUcyoy6m+/UF3t2n8Qkn7 dI8ooamWhIPFcwTbnHLkdPux9uuYW9vCLgC9C3OeJrlcgaiaCh4vSZP9Y102U3uCHr3h fD98fcP6/lsQnNMbUXM2GBTmRhmuP3nsM6TQR5s3ADY2QcL+afsdxD1qHIuJIOvCLJm9 z0kcgfPRJzGQLwIUJfk+ncMFT3ZKE049x88Fi22qaGohmQtXZJLcdxRHb7eSup05Jyd4 8k/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=TdHSORJrE1+O+ZxT6A2GB6Q1lAakbB6kyDpZTpCGMAQ=; b=Di3fpDaMhF8boX9ibRA1Eqicr+1ZPAaYci+pifdehtpEPfO+tIFlz6sJM2+fzIc6jZ kRzJK/oqC1X5sE5ZTS0oKq03a+UC9fb6kodDtWmpZw4KXOhtb97j8sDew/pdpH413Tv3 azkF3xoj4mrZeKKD+gyPtuPQy29OQWCgKeO6Sjsze7zZGz2bMjsBYklQsbaka0uuL/kM FbY/K50eEQojXABXOpA986X0Hpml26GOsUwhlw6i9huy3jz6Up5EGFI/5KiAwqbJUZ1H SldOdE/iipmeau7eiWtbC8Sr+VEWDQnevfFCA3/dc42HMkvOopBV/fXdXzviq0KOxiyo tmQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IXbxE35I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020a056a00218500b004fa3a8e0084si11712619pfi.315.2022.04.23.07.03.22; Sat, 23 Apr 2022 07:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IXbxE35I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbiDWKd2 (ORCPT + 99 others); Sat, 23 Apr 2022 06:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbiDWKdZ (ORCPT ); Sat, 23 Apr 2022 06:33:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5211EACF; Sat, 23 Apr 2022 03:30:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0117E60F72; Sat, 23 Apr 2022 10:30:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51ABFC385A5; Sat, 23 Apr 2022 10:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650709828; bh=ff4v014/iePNUz+icT/yCsh2zIx6F6nb3gqJB1eZ8UE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IXbxE35IvogCm4AZ8zf3jDibpQvSyM0C/W7X9aOUpsRCzXOI07cfGdkWgEbDXWuCr kHSslvl42YFufuJLUjxH+6Rlemh4k5ehoJ0U76XnWwo/D64jT3So83tqkAFjCS9+H6 9XGZjuNh5XDyj1VT2QzlODsbPR56lIo8wzJ2/IPR+6qUMek4L2BCV/t5x64hN25Q8y Xr9LLlVN3fF+XBKV03hhLSY0wx9o5lEU7yd8whJ6OEG30xUTbuEa5djU8KMh+2QwPC oAsEmKmW3z1C/HA7pmQSaW9nJigb1Pte7SU3itFZmqvPUSBZDBhkZgGwGurE72xs+j 1h8z5Y+LbCwCQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=billy-the-mountain.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1niD21-006Mq2-Qb; Sat, 23 Apr 2022 11:30:25 +0100 Date: Sat, 23 Apr 2022 11:30:25 +0100 Message-ID: <874k2kccse.wl-maz@kernel.org> From: Marc Zyngier To: Linus Walleij Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Thierry Reding , Joey Gouly , Jonathan Hunter , Hector Martin , Sven Peter , Alyssa Rosenzweig , Bjorn Andersson , Andy Gross , Jeffrey Hugo , Thomas Gleixner , Basavaraj Natikar , Shyam Sundar S K , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v3 00/10] gpiolib: Handle immutable irq_chip structures In-Reply-To: References: <20220419141846.598305-1-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linus.walleij@linaro.org, linux-kernel@vger.kernel.org, brgl@bgdev.pl, thierry.reding@gmail.com, joey.gouly@arm.com, jonathanh@nvidia.com, marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, bjorn.andersson@linaro.org, agross@kernel.org, jeffrey.l.hugo@gmail.com, tglx@linutronix.de, Basavaraj.Natikar@amd.com, Shyam-sundar.S-k@amd.com, andy.shevchenko@gmail.com, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Apr 2022 22:24:22 +0100, Linus Walleij wrote: > > On Tue, Apr 19, 2022 at 4:19 PM Marc Zyngier wrote: > > > This is a followup from [2]. > > > > I recently realised that the gpiolib play ugly tricks on the > > unsuspecting irq_chip structures by patching the callbacks. > > > > Not only this breaks when an irq_chip structure is made const (which > > really should be the default case), but it also forces this structure > > to be copied at nauseam for each instance of the GPIO block, which is > > a waste of memory. > > > > My current approach is to add a new irq_chip flag (IRQCHIP_IMMUTABLE) > > which does what it says on the tin: don't you dare writing to them. > > Gpiolib is further updated not to install its own callbacks, and it > > becomes the responsibility of the driver to call into the gpiolib when > > required. This is similar to what we do for other subsystems such as > > PCI-MSI. > > > > 5 drivers are updated to this new model: M1, QC, Tegra, pl061 and AMD > > (as I actively use them) keeping a single irq_chip structure, marking > > it const, and exposing the new flag. > > > > Nothing breaks, the volume of change is small, the memory usage goes > > down and we have fewer callbacks that can be used as attack vectors. > > What's not to love? > > > > Since there wasn't any objection in the previous round of review, I'm > > going to take this series into -next to see if anything breaks at > > scale. > > The series: > Acked-by: Linus Walleij > > Bartosz: if you're happy with this can you apply it to an immutable branch > from v5.18-rc1 and merge that into the GPIO for-next and then I can also > pull that into pinctrl? For what it is worth, I've pushed this branch into irqchip-next. You can pick it up from: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=irq/gpio-immutable but I can also drop it from the irqchip tree. Just let me know. M. -- Without deviation from the norm, progress is not possible.