Message ID | 20230208094813.20874-1-walter.chang@mediatek.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3362575wrn; Wed, 8 Feb 2023 01:54:28 -0800 (PST) X-Google-Smtp-Source: AK7set8z15CeSc5ScBYhuTjVGN7gIfIlqI7me85xIK+lwVG1EKuGrMckJZgshWqi74xiodEg194B X-Received: by 2002:a17:90a:4495:b0:22c:a177:1ece with SMTP id t21-20020a17090a449500b0022ca1771ecemr6334761pjg.1.1675850068037; Wed, 08 Feb 2023 01:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675850068; cv=none; d=google.com; s=arc-20160816; b=ljl2G17JvGLu8lmKAO00ga9sd00aRQh8LkcVsH5bgonMUh8ZEq7MdcCkzrBz5WKvAr ltmFiPxAq8V2mhrdtKoDUB0N52Hjpp5aDTR4W/AJpGtGBQveA6/c2u5Hmg8dTH3gZF7Z rcgas9yI++S+1G/e4uJGoqmo/FvaR+4O+ZR+pfqEOrQmPOK7Y+0OHwv02Pkq215Kl+qH Nmh1lwcNPSHkVdweh2g4Q86/S6lFxRxf/rJnJQbJipsBnJ7+BAqOF6AL1QzN3BXrj+4Q RkEwWMi3KEMszS7aChumcLJETHruuChnDXN56YdkmcZZ9JWzhhAW6szXOl6PFy52iOJK eoRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=5vAVo8s7+PXjhGPDooPf0JHAVPlVJ0y1JX0yuNnp80c=; b=vl4OIy2jtdhkcxL2H8aUpqBGnMVkqYy7kw7JzPo7TfJlklDSbVj1U9F+/hhOaAZl0b uCvWI6E4LUT3HsPrHtuo6s3yn6iGRaXrDcfiqs4C73nDbLHInNSFy0BhnsgU1Qq6p3nn PcPDqoK/TeoYOYEnY46mF4ZfZRm++BWLDAibI/EyHQT5uH4OtBCTz7RLK+twRUPnFvFv svGC9U+6Lp4PVNJtMmQoDmpnvLjllxl0MVUxwPEwXNUpNCGbo2NnIOttdRd25x2faFQW biFcOIoUG1YB7ckoiODBU3XZJGRJaZhZu0cTfWUsFWtUrN7TdQlmxaeAYO8NRsR0rn3S NzIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=RmVi4rzz; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a17090a748900b00230c82c6284si1687133pjk.19.2023.02.08.01.54.13; Wed, 08 Feb 2023 01:54:28 -0800 (PST) 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=@mediatek.com header.s=dk header.b=RmVi4rzz; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbjBHJu3 (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Wed, 8 Feb 2023 04:50:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjBHJuI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Feb 2023 04:50:08 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C776193CB for <linux-kernel@vger.kernel.org>; Wed, 8 Feb 2023 01:50:06 -0800 (PST) X-UUID: f35c5484a79511ed945fc101203acc17-20230208 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=5vAVo8s7+PXjhGPDooPf0JHAVPlVJ0y1JX0yuNnp80c=; b=RmVi4rzzDRDeG5O1AKA3EoqPXr4E6Y/8VDM3A5yH28fTkAY2p4Ep8rQtRJZNK1Nh8iomlU/iXqHWQB6G3R8WUD9x8dEw6H0PMokm0Dl4wtfqpoGOc28r4yEnxwPP/1e3P7iVJrNrFGxEB5zjPOdQpp416gcUMkSVQ6HuVC240gA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.19,REQID:3184567d-63b6-4200-9513-04d70e1013ab,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:885ddb2,CLOUDID:049aab56-dd49-462e-a4be-2143a3ddc739,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-UUID: f35c5484a79511ed945fc101203acc17-20230208 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from <walter.chang@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1811119605; Wed, 08 Feb 2023 17:49:59 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.194) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Wed, 8 Feb 2023 17:49:58 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 8 Feb 2023 17:49:58 +0800 From: <walter.chang@mediatek.com> To: Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, "Maciej W . Rozycki" <macro@orcam.me.uk>, John Stultz <jstultz@google.com> CC: <wsd_upstream@mediatek.com>, <stanley.chu@mediatek.com>, <Chun-hung.Wu@mediatek.com>, <Freddy.Hsin@mediatek.com>, Walter Chang <walter.chang@mediatek.com>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org> Subject: [PATCH 0/3] Support timer drivers as loadable modules Date: Wed, 8 Feb 2023 17:48:01 +0800 Message-ID: <20230208094813.20874-1-walter.chang@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757256161378908547?= X-GMAIL-MSGID: =?utf-8?q?1757256161378908547?= |
Series |
Support timer drivers as loadable modules
|
|
Message
Walter Chang (張維哲)
Feb. 8, 2023, 9:48 a.m. UTC
From: Walter Chang <walter.chang@mediatek.com>
This patch exports functions in kernel so that timer drivers,
such as timer-mediatek.c can become loadable modules in GKI.
Chun-Hung Wu (3):
time/sched_clock: Export sched_clock_register()
clocksource/drivers/mmio: Export clocksource_mmio_init()
clocksource/drivers/timer-of: Remove __init markings
drivers/clocksource/mmio.c | 8 +++++---
drivers/clocksource/timer-of.c | 23 ++++++++++++-----------
drivers/clocksource/timer-of.h | 6 +++---
kernel/time/sched_clock.c | 4 ++--
4 files changed, 22 insertions(+), 19 deletions(-)
Comments
On 08/02/2023 10:48, walter.chang@mediatek.com wrote: > From: Walter Chang <walter.chang@mediatek.com> > > This patch exports functions in kernel so that timer drivers, > such as timer-mediatek.c can become loadable modules in GKI. What for ?
On Thu, Feb 9, 2023 at 7:36 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > On 08/02/2023 10:48, walter.chang@mediatek.com wrote: > > From: Walter Chang <walter.chang@mediatek.com> > > > > This patch exports functions in kernel so that timer drivers, > > such as timer-mediatek.c can become loadable modules in GKI. > > What for ? In general, it's the same reason why modules exist: We want to be able to support a wide array of devices with a single kernel, but we don't want all devices to pay the memory cost of code that will never be used there. So being able to support loading device-specific bits like clocksources (along with other device specific logic) helps. Obviously it still has to make sense, and others have raised concerns of stability issues if the hardware support is needed before we can get to module loading, but I think if this allows drivers (such as timer-mediatek) to be loadable safely, I see it as beneficial. (And as others pointed out: this patch series is incomplete as it doesn't modularize the timer-mediatek driver, which would be a prereq to supporting it upstream) thanks -john
On Thu, Feb 09, 2023 at 11:50:49AM -0800, John Stultz wrote: > On Thu, Feb 9, 2023 at 7:36 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > > > On 08/02/2023 10:48, walter.chang@mediatek.com wrote: > > > From: Walter Chang <walter.chang@mediatek.com> > > > > > > This patch exports functions in kernel so that timer drivers, > > > such as timer-mediatek.c can become loadable modules in GKI. > > > > What for ? > > In general, it's the same reason why modules exist: We want to be able > to support a wide array of devices with a single kernel, but we don't > want all devices to pay the memory cost of code that will never be > used there. So being able to support loading device-specific bits like > clocksources (along with other device specific logic) helps. Agree, that is why modules are for. > Obviously it still has to make sense, and others have raised concerns > of stability issues if the hardware support is needed before we can > get to module loading, but I think if this allows drivers (such as > timer-mediatek) to be loadable safely, I see it as beneficial. From a technical point of view, it is arguable. But my main concern is the real reason of changing this to the module format. I see that as a way to overcome the effort to upstream the drivers. And the GKI is an alibi to justify the module conversion. Given the timers is a base brick of the core subsystems, without proper support of the timer (eg. bug fixes), the platform support will be wobbly.
On Fri, Feb 10, 2023 at 12:52 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > On Thu, Feb 09, 2023 at 11:50:49AM -0800, John Stultz wrote: > > On Thu, Feb 9, 2023 at 7:36 AM Daniel Lezcano <daniel.lezcano@linaro.org> wrote: > > > What for ? > > > > In general, it's the same reason why modules exist: We want to be able > > to support a wide array of devices with a single kernel, but we don't > > want all devices to pay the memory cost of code that will never be > > used there. So being able to support loading device-specific bits like > > clocksources (along with other device specific logic) helps. > > Agree, that is why modules are for. > > > Obviously it still has to make sense, and others have raised concerns > > of stability issues if the hardware support is needed before we can > > get to module loading, but I think if this allows drivers (such as > > timer-mediatek) to be loadable safely, I see it as beneficial. > > From a technical point of view, it is arguable. > > But my main concern is the real reason of changing this to the module > format. I see that as a way to overcome the effort to upstream the > drivers. And the GKI is an alibi to justify the module conversion. [Putting on my Android Antennae for a moment] I can promise the GKI is no alibi - it is a real thing. Part of convincing vendors to ship the same kernel is that we have to be able to bring the security benefits of being able to update the unified kernel without major impact to memory. Utilizing modules (all over - as a lot of small cuts add up) is crucial for that. Some vendors haven't historically been great about upstreaming device support, and I understand the concern that allowing modules might enable vendors to keep modules out of tree. But vendors inclined to do that will find a way regardless (and because at a practical level, because the need to keep the GKI size down the android tree will have to carry a similar change to the one submitted here), so I don't think rejecting such patches is a real disincentive. Instead it just creates further needless fragmentation between upstream and android kernels, which makes it further difficult to justify and motivate upstream-hesitant vendors to submit their code to lkml. And again, there *has* to be upstream users, as we should not have any maintenance burden for out of tree code! But in this case the upstream timer-mediatek driver was named as a candidate module (obviously those patches are needed when this series is re-sent). Additionally, while I understand the concern and skepticism, for folks who are working on upstreaming (Mediatek along with folks at Collabora have done some great work!), having to deal with this meta-issue of questioning of one's purity-of-intent, when one is actually submitting patches I think makes the process of dealing with the community seem even more difficult (making some folks question why bother). The upstream kernel community is an amazing thing! And I understand why we want to be protective of it. But I also worry that if we get too wrapped up in suspicions of ill intent, we aren't going to be able to bring folks into the fold and grow the community. The license doesn't require one to work with the community, so we should probably be using more carrots and fewer sticks. > Given the timers is a base brick of the core subsystems, without > proper support of the timer (eg. bug fixes), the platform support will > be wobbly. As for bug-fixes, it should be noted that with the GKI, not all modules are vendor modules! There are GKI-modules, which are common drivers/subsystem-infrastructure used by many devices (such as NFC, Bluetooth, etc), and these in-tree drivers are updated with the GKI kernel as modules. So there is motivation to ensure bug fixes to those upstream drivers land upstream so they can be included when the GKI and GKI modules are updated. And to your point about it being a base-brick - Yes, obviously not everything can be loaded from a module safely, and that's fine. But in cases where devices can boot with a built in architected timer, then are able to switch to more device specific clocksources, we'd really like those device specific clocksources to be modules. thanks -john