Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1921425ybh; Fri, 17 Jul 2020 05:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy57xqd5XtEdErbdSw1GLoTbIdk1FM3un6O549tX8mp94lscPOmYoB3iFKMhH1BChQMiHCg X-Received: by 2002:aa7:d4d2:: with SMTP id t18mr8702436edr.166.1594987490874; Fri, 17 Jul 2020 05:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594987490; cv=none; d=google.com; s=arc-20160816; b=X9cS/pTCwtUEcSHt9+nP9SVSTUDuD9HEw3UBc3VFkXtB/wAA6AsE2SrneyXdIyprLl O/Bge/ANgeX9S7ux3NHg+8w88BadVpkDQpGOXTRwCGXydeONqOvj7kAvjkJUsg8xMCuM mrWRFBLaF+AHFoNy5GE7Skg+SQd0dLYbYpWCMI9xk2UVelSukzRg2QQx5xeF4zErowke GUZgFGJHUPlNrwmv3haRDndHAd4jb7Gf/ILKQMOk1V3wOjAwsJMP5AwHa/akFCyxC2yE IH6oUOzocohZT73bORBDgFzGq5KTVkC3wHDhtkmKyuTulTVjFTa9rgFjMS7NgsWCnG/i XVCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ub697sVNwFF1cayMFoyuXRD/DoOaqjni0fvqH97Bh1w=; b=rcbUPK23xGdwhqW5F/6DRoyKhYdUdBEamj+sN5HpKgG7/TrO2eJjDVyWBy2n0JAeFc ovbfPBh2RLVtywysx5yfVYBIm1VLFGO2HA1GBMTcJWbxYfdcZ6neA+Uh2pD7oPS90zD7 bNLLVs48of0Ved0UpOpA1qzxuSkchOvIIM6GFO7vi5KE+KNSrG4Nms3DbKjSKpLgN3j/ zF3CO6gD0hGZcNjp3vurpY3cVXPlO0/z4ww7tb62WGVVYDmc85xCJH9eUmOxj/Yfbv1s XyToYQOZGRzLgpy3wqWi4BmIqPWf4hzAxC3oUMLbFW0eYGv9uE+ZngYNoJfZkxVoXktx 6tYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IHn/oQ3b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 60si5259968edp.566.2020.07.17.05.04.28; Fri, 17 Jul 2020 05:04:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IHn/oQ3b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbgGQMBa (ORCPT + 99 others); Fri, 17 Jul 2020 08:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbgGQMB3 (ORCPT ); Fri, 17 Jul 2020 08:01:29 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47179C08C5C0 for ; Fri, 17 Jul 2020 05:01:29 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e8so12317972ljb.0 for ; Fri, 17 Jul 2020 05:01:29 -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=Ub697sVNwFF1cayMFoyuXRD/DoOaqjni0fvqH97Bh1w=; b=IHn/oQ3biBmtQTO5y7w6n8hxo4+QzjCMbkZ1yYDEmlK1IiEezprP1XH4WeAHB2zkHe hmdMyuTF1dqBdEUsXKFaqlfCQVn0rz3kdGh01jVdAMYMlh8dKckB6QiQb+Z3J9IEWpov Wj/tGt7StMejsVMfR63BSFLTj5vywd40zL2bAOryUkVHWuWJ2eGzJnYPRamRGxAo69hT l/EBIEEBX5eEqhjV4NKVn0aFVGQfI23mg+z0Q5NeiwOXlcFeOln4x5woeIRnF1hj6X3y RdMs52IyAVdBgTN7DeAzbCTCQrAMFhghih+fFuQ+cuBiRZ0Oo5JJF3eXDGk91tNE4Hqk CfaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ub697sVNwFF1cayMFoyuXRD/DoOaqjni0fvqH97Bh1w=; b=VcIoLECd2TfQRXhldPuw1wUvu8uGnEx1mrYtp0lWZC1YjQCPLR/qP5pWRpeTe4DDTx iNcz2Ql6rSYdwFQcynAxncpyAFXCHc6snIH1PDUXG/rMNaKJZj9iyOJRK3J322i0fiaN jlV0CVKaqr1qcBeJsS7W8xJ/SeYVIL52P/cqCkFU8IySPck0HQxOBBkHl9HUB+Zy0TXj pbUX3MEJJKIFfhc1z6JZOdturwFGPZZXAeSwsiHHywdDYmJ5KsVfq4NeUFP8kTGt6bng 1Wp2plgf+B70LGVnSRFK5NbJaERQ7pNVai0wzWXlPStOKYxeruX9gxrbtUf9uiPVhZTC A9nw== X-Gm-Message-State: AOAM5335kmWyVHs5eBH+8yGCvhHBc6WeSdnBXjDUt4ZrFi4fYwa+syvw ESwMciy+ME4LS/pVXgZB07HVUC2uaJqCv37rDWAFDg== X-Received: by 2002:a2e:7a1a:: with SMTP id v26mr4129807ljc.104.1594987287043; Fri, 17 Jul 2020 05:01:27 -0700 (PDT) MIME-Version: 1.0 References: <1594164323-14920-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: From: Linus Walleij Date: Fri, 17 Jul 2020 14:01:16 +0200 Message-ID: Subject: Re: [PATCH 1/3] gpio: mxc: Support module build To: Anson Huang , Greg KH , John Stultz Cc: Russell King , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , Catalin Marinas , Will Deacon , Bartosz Golaszewski , "oleksandr.suvorov@toradex.com" , Adam Ford , Andreas Kemnade , "hverkuil-cisco@xs4all.nl" , Bjorn Andersson , Leo Li , Vinod Koul , Geert Uytterhoeven , Olof Johansson , Linux ARM , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , dl-linux-imx , Jon Corbet Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Greg, John, we need some guidance here. See below. On Thu, Jul 16, 2020 at 4:38 PM Anson Huang wrote: > [Me] > > On Wed, Jul 15, 2020 at 4:44 AM Anson Huang > > > I tried to replace the subsys_initcall() with > > > module_platform_driver(), but met issue about " > > > register_syscore_ops(&mxc_gpio_syscore_ops);" which is called in > > > gpio_mxc_init() function, this function should be called ONLY once, > > > moving it to .probe function is NOT working, so we may need to keep the > > > gpio_mxc_init(), that is another reason that we may need to keep > > > subsys_initcall()? > > > > This looks a bit dangerous to keep like this while allowing this code to be used > > from a module. > > > > What happens if you insmod and rmmod this a few times, really? > > How is this tested? > > > > This is not really modularized if that isn't working, just that modprobing once > > works isn't real modularization IMO, it seems more like a quick and dirty way > > to get Androids GKI somewhat working with the module while not properly > > making the module a module. > > > > You need input from the driver maintainers on how to handle this. > > As far as I know, some general/critical modules are NOT supporting rmmod, like > clk, pinctrl, gpio etc., and I am NOT sure whether Android GKI need to support > rmmod for these system-wide-used module, I will ask them for more detail about > this. > > The requirement I received is to support loadable module, but so far no hard requirement > to support module remove for gpio driver, so, is it OK to add it step by step, and this patch > series ONLY to support module build and one time modprobe? While I am a big fan of the Android GKI initiative this needs to be aligned with the Linux core maintainers, so let's ask Greg. I am also paging John Stultz on this: he is close to this action. They both know the Android people very well. So there is a rationale like this going on: in order to achieve GKI goals and have as much as possible of the Linux kernel stashed into loadable kernel modules, it has been elevated to modus operandi amongst the developers pushing this change that it is OK to pile up a load of modules that cannot ever be unloaded. This is IIUC regardless of whether all consumers of the module are actually gone: it would be OK to say make it impossible to rmmod a clk driver even of zero clocks from that driver is in use. So it is not dependency-graph problem, it is a "load once, never remove" approach. This rationale puts me as subsystem maintainer in an unpleasant spot: it is really hard to tell case-to-case whether that change really is a technical advantage for the kernel per se or whether it is done for the greater ecosystem of Android. Often I would say it makes it possible to build a smaller kernel vmlinux so OK that is an advantage. On the other hand I have an inkling that I should be pushing developers to make sure that rmmod works. As a minimum requirement I would expect this to be marked by struct device_driver { (...) /* This module absolutely cannot be unbound */ .suppress_bind_attrs = true; }; So that noone would be able to try to unbind this (could even be an attack vector!) What is our broader reasoning when it comes to this? (I might have missed some mail thread here.) Yours, Linus Walleij