Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1929653ybh; Fri, 17 Jul 2020 05:16:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzMKFLXt3lRGWVaTNuA/mse9zJNP35FLhX1PR8JhB8Z4KKQSeBbwGchd3mxAQmwEUn72jk X-Received: by 2002:a17:906:3889:: with SMTP id q9mr8838482ejd.318.1594988170654; Fri, 17 Jul 2020 05:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594988170; cv=none; d=google.com; s=arc-20160816; b=Z9e49q1kaiVTdZgvDFeXTneMLdsjnn7YLMypMZ4jVVzBHSU/91Kjc5lbgjwpRkXqu7 ZUwGz0pO0YDwwHZ+RTXwYBKqr2cCgis5TqI6dYw03rUqZicEx8jq0/JvMpUQCmJFdqD+ HQbiRk305/9riRHVHwpmFdRO0tLEWNXRsMrNfguUUg51s9+Yocw4k0PJKL7LTaxvSOIy O/+90MJkILgoUUgf+orih8br6O6JBTunmL/MlocYPApOP3Tq3qtBnGwK6lYQz/AHG4C2 iEzDhO+ihG9ccSUpSV6vPJ2RojxmlhIytAF03OjT12qDsogEppOv4gld+rbLTgtm8rVv u3Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zZIvKYknplF0B3MzYad85r/wqmm21WKGBoZn2Jg6kCM=; b=F94FHP1C3s2nyjdZ7azQPyY6z6dj3eYKz9GUNW3rFwW0OyVeJpPCuVSPiYxAZWNEaY 5UrBq+toEvxLR3p3Jj42kx8xcsJmYJ0XndvN6+z4WRans98WCbXZP6P6urLqhdgUwoqC LRnPUvBJtT/hAoR3saAcVVIlpFssgrNFaGxxFZQ3Yco0ebiZKuK4vpjNkyo27n3CsL3D cUl6zSkL5UROnCmBSo2I9UIXmRkKOOeDPAShv6r/dLx3EGCYGslGnKGQNr3Rtk6MokLJ rrqt6dHytgmZEupbLs6nQ5GlJbIcbqekPHz5eR6fRvWk7z0CFML4aBq+q6Q+OkpgenaL n5rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p6FRGlOR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e22si5216124ejb.66.2020.07.17.05.15.47; Fri, 17 Jul 2020 05:16:10 -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=@kernel.org header.s=default header.b=p6FRGlOR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726335AbgGQMOq (ORCPT + 99 others); Fri, 17 Jul 2020 08:14:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726113AbgGQMOq (ORCPT ); Fri, 17 Jul 2020 08:14:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9674D20717; Fri, 17 Jul 2020 12:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594988085; bh=kQgaBPzZfXga09Lqrx8wezDWPrDUuin2mS2Z1Z+whfg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p6FRGlORHXpKEYBn0ItKKmJUsOqQE8Fxy+n52tof+J8hS401jHCZT/83Fls1fGYR/ FwNotv56Ks6M/2+FbxgGQ+zglvR2J4DqQhefMFE8ndjLGYz8xEy4KZA+dKNbcwMX7q 9hsVCffpc26VXWSO9GcSTe9kGWK3rgsLr6D94p1A= Date: Fri, 17 Jul 2020 14:14:36 +0200 From: Greg KH To: Linus Walleij Cc: Anson Huang , John Stultz , 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 Subject: Re: [PATCH 1/3] gpio: mxc: Support module build Message-ID: <20200717121436.GA2953399@kroah.com> References: <1594164323-14920-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 17, 2020 at 02:01:16PM +0200, Linus Walleij wrote: > 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. Why can't the module be unloaded? Is it just because they never implement the proper "remove all resources allocated" logic in a remove function, or something else? > 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. Sounds like a "lazy" 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. I can see where a number of modules just can not ever be removed because of resources and not being able to properly tear down, but that doesn't mean that a driver author shouldn't at least try, right? > 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; > }; No, that's not what bind/unbind is really for. That's a per-subsystem choice as to if you want to allow devices to be added/removed from drivers at runtime. It has nothing to do with module load/unload. > 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.) Android is just finally pushing vendors to get their code upstream, which is a good thing to see. And building things as a module is an even better thing as now it is finally allowing arm64 systems to be built to support more than one specific hardware platform at runtime. So moving drivers to modules is good. If a module can be removed, even better, but developers should not be lazy and just flat out not try at all to make their code unloadable if at all possible. Does that help? thanks, greg k-h