Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1958351ybh; Fri, 17 Jul 2020 06:04:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfGtfiTHPwjTeRtiyugGksacKsqMccmZyuuvBEDTtO1KTD3e9DKG0dvqUdRMqbfKXPkZjR X-Received: by 2002:a50:ee8d:: with SMTP id f13mr8865699edr.302.1594991068178; Fri, 17 Jul 2020 06:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594991068; cv=none; d=google.com; s=arc-20160816; b=u1XPLie1tY17yNCzwTRcmF+mzHQCIWLmGP1T2O54PgME4Ng9b3id3VWWmoPfQ6Dbit DDFaJIfiklHdKdEcJw2iLYRnx7CV5KaSRr3l416qrytaB79IFP2jUSOyKLUzJ/C7eD4m JC2vy2A8T2CzwKEhf/JPqqvfy2QiahAtkaK0NPGdVPriupaHCty3umAm3gGPSQvXn0gC IJgRqLCvqj/cakZ64alASkeijqHlafhcvkco6vxPVMUENxUen3JDukYLn74eBtpC8aR5 sApmECF5YGNY1z4sUv/5ELwKKUDn+W2CqNxQZ+sKk18fs5ClJm+ZjHLchKnTReVmLfvE ZJlw== 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; bh=pSzes3TZy8IVYD6ovyZ3lQdfg/pL8k3FijQ8anuaAjw=; b=GdhYEI+CYC/NcHysZxEdKersAw3WlIUxvQw8mQbtIhy3scL9g5j6qgs1TKdz/uSrTn pCSHkgqqB0LAa5WmyaYvqcCYFgn16sdUBmWA/5RmaB6JOKgrlh3le1dZuNnki0Bq6Vx9 w5zUx0Ymg7qZtjq2NCCQSPG04zizkhHLxSOQmBNLE0hYAzZXTQiqc3iKDpVkinhdTmcT 4ishjStITBiP4Rv4tXLoStSiTPU1oeXFIh5W0F/9OenAGc8vgbK6Qa1ZogRc+j163v87 T65O8srKUOfNJ7+2UAPsOYL08x1lhlKr7z4blwTmg2Db7H7gwMuqC/FzWCH4nAoeVklU /swA== ARC-Authentication-Results: i=1; mx.google.com; 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 x6si5310385ejw.73.2020.07.17.06.04.03; Fri, 17 Jul 2020 06:04:28 -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; 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 S1726775AbgGQNDQ (ORCPT + 99 others); Fri, 17 Jul 2020 09:03:16 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:43175 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbgGQNDP (ORCPT ); Fri, 17 Jul 2020 09:03:15 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MTiLj-1kPt8u0C9F-00U51X; Fri, 17 Jul 2020 15:03:13 +0200 Received: by mail-qk1-f173.google.com with SMTP id l6so8600047qkc.6; Fri, 17 Jul 2020 06:03:12 -0700 (PDT) X-Gm-Message-State: AOAM530mCiCYf9tTIJWUd/6WM6kGqzkyWI6uR6i3/wyO9zPppOQcz3b2 vlRhhqzZQ3lvUCFli22IOBSqeoWWsN/Rn3KkU1Y= X-Received: by 2002:a37:9004:: with SMTP id s4mr345881qkd.286.1594990990628; Fri, 17 Jul 2020 06:03:10 -0700 (PDT) MIME-Version: 1.0 References: <1594164323-14920-1-git-send-email-Anson.Huang@nxp.com> <20200717121436.GA2953399@kroah.com> In-Reply-To: <20200717121436.GA2953399@kroah.com> From: Arnd Bergmann Date: Fri, 17 Jul 2020 15:02:54 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] gpio: mxc: Support module build To: Greg KH Cc: Linus Walleij , Geert Uytterhoeven , Catalin Marinas , Bjorn Andersson , "oleksandr.suvorov@toradex.com" , Fabio Estevam , Anson Huang , Jon Corbet , Will Deacon , Russell King , Bartosz Golaszewski , Andreas Kemnade , dl-linux-imx , Sascha Hauer , "open list:GPIO SUBSYSTEM" , John Stultz , "hverkuil-cisco@xs4all.nl" , Adam Ford , Linux ARM , "linux-kernel@vger.kernel.org" , Leo Li , Vinod Koul , Sascha Hauer , Olof Johansson , Shawn Guo Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:PnQgfgYwfYuuBJpj1xktjWOKhKrYJMPulmrPaQn13yympd5z086 fFNKoxjp399F/B0P/4xk4EeGefedP7JmZ8flmq6GwPByEKWy6VleOI/Q2UBESg7z0hq3FHA MebFneHpbr8IwlCDLrpvtRXEKweddZpXhS2WPgnpcb1Ar7lfqVXUZHTlsZj3CcM1/rQKw5i hAhvJ+QCfY0KNFmSgbHDQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:uuxEPBDLxAo=:ZBHYdUNSQHm+QtoJnY+ioX hohXKN6vTf1tWwYkMveqTS4QC6l6N1Ytq/2WVNTkzu3QQZP70LjkwD8JrRv1A+x49q3su6oVm d7hQNiTJ50b9bpSQQ2CPQR1adHflwe1f9nGe8bbbP9hVeRENlJ+Ogf4XqDJRmXZV+2lIPx34v b98Zujh7DXaV9S3ce/lhErC4tUngUsesrmwqnftOTx4RccGwVNLUrAQgJp2WxhX5CiPF+oK3n YQwL9ku7FruvORB/GFv+BdMCrfALHUKn+waeQSGjktmDcsaCzQQTuWk4ni7rW+5jazKniCf4V hLXg6vyuB3OwxFMEl7zhsQYiU9vx17oJKh/03NpF+FmrbBrulp6EyciHqAtmMpc6w6kG+i+aD JT4nbDc2ZxUlwQaOXzTvoY5T5a/Uc6JLPjtsJDqqGkxGL0+o6+4DAZhiAFnUOJsOTzkVttR+F q+vJxrsDpVD1hdHO9u9pmvWZywq3aTDHzlmpDSe6NpUqfGXdW/ollh46Ai80DJGXXawrYWuJ7 ciatQsAfLwL1wsDDSYkzyv1WvNO7DMpLgLAIz6jhscLDiJ1O8Cwg5EG/TqOMWVE6YzO0v9WVr yRr+36ZQ41H7iwJCerFnhpLuUY+FD9o2x4sdMF/OuwI7nBNdG7eESphX7S9jCne+qQwthtQpK WO5lhUrCEPQ1KpKeXVqGuRn7RkFvHIGrGBGilMi/sWy8I7UHY3qV/Ut/3ukwyFrYRptchvIL7 DpqUwx9CpSzblDKDv2OVsnB/Kt9saeRpNxro26kC513QwvWUiTOLEAWmbCzYQ4J9dG8ZQCbGf Vcadvn6WC/l5TfLDoZVfLyKM5KMO2zoKLKJjs9zCtFDg/6vAHZ9HaXqjQabbgqPzQM1BIEuJD xx3wEtvydBAje4ONy21hE+5LNAcPXK3k4BiLaUpqESs0709kZpAmBlb4wp6eZz2/H7n9HhdMM hqxBCKTdYNABvk4FdLZs+apHThFjRmPaCyP7w/LG5jZllZBdgayRs 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 2:16 PM Greg KH wrote: > On Fri, Jul 17, 2020 at 02:01:16PM +0200, Linus Walleij wrote: > > 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? For the core kernel parts, it's usually for the lack of tracking of who is using the resource provided by the driver, as the subsystems tend to be written around x86's "everything is built-in" model. For instance, a PCIe host bridge might rely on the IOMMU, a clock controller, an interrupt controller, a pin controller and a reset controller. The host bridge can still be probed at reduced functionality if some of these are missing, or it can use deferred probing when some others are missing at probe time. If we want all of drivers to be unloaded again, we need to do one of two things: a) track dependencies, so that removing one of the devices underneath leads to everything depending on it to get removed as well or will be notified about it going away and can stop using it. This is the model used in the network subsystem, where any ethernet driver can be unloaded and everything using the device gets torn down. b) use reference counting on the device or (at the minimum) try_module_get()/module_put() calls for all such resources so as long as the pci host bridge is there, so none of the devices it uses will go away when they are still used. Traditionally, we would have considered the PCIe host bridge to be a fundamental part of the system, implying that everything it uses is also fundamental, and there was no need to track usage at all, just to ensure the probing is done in the right order. > > 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. It's a one-way dependency: If we can't allow the device to be unbound, then we also should not allow module unloading because that forces an unbind. Arnd