Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp997204pxb; Fri, 22 Apr 2022 16:18:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1bjJit3y0Kk2HOhM0o6gWWuFjk32NzNqhCsa4cTEW/Rv3FiTkMEdYvhj/5ivQrW4NqVj1 X-Received: by 2002:a17:903:18f:b0:15a:d3e:1e47 with SMTP id z15-20020a170903018f00b0015a0d3e1e47mr7094240plg.54.1650669517069; Fri, 22 Apr 2022 16:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650669517; cv=none; d=google.com; s=arc-20160816; b=zeH09thvb3a7ld2j8IT23sOKh7bgD7nr07vnkDJnNOmZZOKk7VfZMmAcS6nAq8mN7c zZfJ0LGrfidGCbVw3HoV2JSGxSZl3rrF1gpZFPvQ1n2PyF5eUR30GGjV9PmyAjS0xHjn 9pDJfTXwD8ll+vDrHd11FNnRvHeU6Atl11lk9O6NzfPQ1A3gQg3BFmOjXWk5WENVDNNE L7Yto7tKtwtFLFVt1w7SKsJeXx4WOVYpd+qHpmR/q35r/SehlA68QLDfEujvXkj2aHlL Z+c4iZEABRDxPNaSRtQb/KON9gJCGzOoD0+45WiEiLGt92dvV/2UJPWkCrtKXIq70Pe2 M4Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SOU4gw2OndPAHlyb0Yx1jIvLcwnBW7WU3bDm4X/+Fi4=; b=vOGWmVa0SLiHeIMtfop6Fcu6UHCbLBIfJc+1L7iiK+NPMt/n3+UolD14W1n0PAg6XN OCS8x1fbEe/Zrhop90AF41XpAwEoRm5SauIGb8gmhVfU9lPjmKMsxMQL1Fhvzs9hlhC1 C00dksPDRZlxf51hnjDBQhxlsGdnNlQJsOnpxFGobVWMLiix5rXXZcFtG/ev6vZkTfT/ BHEgyQa4gmeB/eO/efAqpMHCYaGRD+lNvYTdgOUlgoi+H08t4xokbHCPjDWEe2gKvOgk h+vzvC4dPU9ypi8+YPiRBSAIlEkO/msuhIKiqADMdMOMnmttQylFzZmwG+k68lbFZuTk e47Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YfsZ4tU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p6-20020a17090a930600b001d25017fb66si8784749pjo.146.2022.04.22.16.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 16:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YfsZ4tU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C652DD0; Fri, 22 Apr 2022 15:29:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232358AbiDVWbl (ORCPT + 99 others); Fri, 22 Apr 2022 18:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232944AbiDVWbZ (ORCPT ); Fri, 22 Apr 2022 18:31:25 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 296C326B5AC for ; Fri, 22 Apr 2022 14:24:34 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id i20so16720877ybj.7 for ; Fri, 22 Apr 2022 14:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SOU4gw2OndPAHlyb0Yx1jIvLcwnBW7WU3bDm4X/+Fi4=; b=YfsZ4tU3PuYgqcdjIDeQeP3YRzUO5ivIGgFF1ltC/6cArnKzaw0zeJWVYikoKwMjOE OdEykxqICO7B5JcdxEsqUmyHPybbUs/wGZaO8WggpZlsChK/8OwwojOgf1BsBMku+PLG MAtb2fgJpkzrfqNAIEezByuUWj1P12+quEESjC9NqSMK3lSlcD47ha1lp12du7h/IiM9 FDye+1z8JpkXsYNIIFUjATBQPXD1WBJ6fAmgYdNWG36EvLkWWB5Iqb8FzcwT3TpPcJGv ntzQ1/nuCBAT00gA8Shal5DE+qEmWahWgq3yXj3gk7VaHYOto1+FcB+rijHPlvSV+dM8 TjcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SOU4gw2OndPAHlyb0Yx1jIvLcwnBW7WU3bDm4X/+Fi4=; b=dyejMBIeyyPOSpA7Wasf7yRn9AqXUOKs2ADYx7RTk7DK9xR3JEA6nDii26JDk8Yu/n jRiPMjoPj+6igVmjB/dSoB3cikObE4kSBIvS6rbQNs7cRXiu397eliZhak82j/6Vpfvu TzJksjI0FWLPETV0YLcP9aJj2xMKhmcRef0QKRmTYNnc13CYFuRiqFlXM6J0MK1/LCPE SRGrp/NhWqL187GvBEssJT2oKa/o1VbJBS/57+99QQri4HL/n4B+V+GR3ySWNYfptSZb /nhZNS83ZMp0SSIlGGUkALkASoheFTty15HZXMnTcvGfz0BpUDPM3P10T+hJI0p4ntZk 4I2g== X-Gm-Message-State: AOAM531CmCZAh8j2prbDdVBuKP8hSSIGTBrFUQ9Lrci0GF3gdDy2ZJbS yf2J9DaWUO+WXACjkyr2BSOnD3FFOtIYP/5/GNpfYQ== X-Received: by 2002:a5b:dc5:0:b0:624:f16d:7069 with SMTP id t5-20020a5b0dc5000000b00624f16d7069mr6530719ybr.295.1650662673435; Fri, 22 Apr 2022 14:24:33 -0700 (PDT) MIME-Version: 1.0 References: <20220419141846.598305-1-maz@kernel.org> In-Reply-To: <20220419141846.598305-1-maz@kernel.org> From: Linus Walleij Date: Fri, 22 Apr 2022 23:24:22 +0200 Message-ID: Subject: Re: [PATCH v3 00/10] gpiolib: Handle immutable irq_chip structures To: Marc Zyngier 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 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? Yours, Linus Walleij