From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5670AC433E6 for ; Wed, 27 Jan 2021 07:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BB2A2074A for ; Wed, 27 Jan 2021 07:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbhA0HqA (ORCPT ); Wed, 27 Jan 2021 02:46:00 -0500 Received: from mail-ot1-f46.google.com ([209.85.210.46]:35477 "EHLO mail-ot1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbhA0Hoi (ORCPT ); Wed, 27 Jan 2021 02:44:38 -0500 Received: by mail-ot1-f46.google.com with SMTP id 36so847210otp.2; Tue, 26 Jan 2021 23:44:22 -0800 (PST) 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=x0dGkBBCOjjdRO5NeNomyXurGTss4C1Z8jAZPD1nTr0=; b=D/t6/XpngIhr+dElHpkKgt7I9raIdEFD/aIUvplW60JNP0cGyfm8vB5RupvZjShzK8 o9tAFA7R1prXP1p4TWSIDLkFG3Ok12Pr731mwn36mh6OTJ6NZINfAlsYeJiYCMn4aPE8 SoJJP9OWxg7MTI1M8h2hTZq7jAqlg7xGRNqPg+nXVJu12OokR1Tpl3dBANluMPjYMzJd ililMEOfD6U8Wqr+uSU3mqavqrZ1scytN5GGfOAR5AYlkG3bSHsoUnzvbhkv3qH3Tz2A v3cVkmUc3XEWwej1GhByKCSx44Cwci6TR6WIFhOYA/47d0kdY0MbOWh5Hy40AvsjGOAS QW/g== X-Gm-Message-State: AOAM532/RncdhhlpjY2XqfIjMmv+jhWUhCflVCbduVIUpwgMM/NL5QHn KAKKdqvgiH1tZvbdGNoeo4s8OzikM3SJEHe6N+A= X-Google-Smtp-Source: ABdhPJytEiLX+kMjV4Ea2i2rFfKnTCKJB2DxU0jLTV+BpUesrQ9gHru0x+sIRyJPwSKOmvFMZ1Gze3L0qvmdO0bLsr0= X-Received: by 2002:a9d:c01:: with SMTP id 1mr6698124otr.107.1611733436883; Tue, 26 Jan 2021 23:43:56 -0800 (PST) MIME-Version: 1.0 References: <20210120105246.23218-1-michael@walle.cc> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 27 Jan 2021 08:43:45 +0100 Message-ID: Subject: Re: [PATCH] PCI: dwc: layerscape: convert to builtin_platform_driver() To: Saravana Kannan Cc: Michael Walle , Lorenzo Pieralisi , Roy Zang , PCI , LKML , Minghuan Lian , Mingkai Hu , Greg Kroah-Hartman , Bjorn Helgaas , linuxppc-dev , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Saravana, On Wed, Jan 27, 2021 at 1:44 AM Saravana Kannan wrote: > On Tue, Jan 26, 2021 at 12:50 AM Geert Uytterhoeven > wrote: > > On Mon, Jan 25, 2021 at 11:42 PM Saravana Kannan wrote: > > > On Mon, Jan 25, 2021 at 11:49 AM Michael Walle wrote: > > > > Am 2021-01-21 12:01, schrieb Geert Uytterhoeven: > > > > > On Thu, Jan 21, 2021 at 1:05 AM Saravana Kannan > > > > > wrote: > > > > >> On Wed, Jan 20, 2021 at 3:53 PM Michael Walle > > > > >> wrote: > > > > >> > Am 2021-01-20 20:47, schrieb Saravana Kannan: > > > > >> > > On Wed, Jan 20, 2021 at 11:28 AM Michael Walle > > > > >> > > wrote: > > > > >> > >> > > > > >> > >> [RESEND, fat-fingered the buttons of my mail client and converted > > > > >> > >> all CCs to BCCs :(] > > > > >> > >> > > > > >> > >> Am 2021-01-20 20:02, schrieb Saravana Kannan: > > > > >> > >> > On Wed, Jan 20, 2021 at 6:24 AM Rob Herring wrote: > > > > >> > >> >> > > > > >> > >> >> On Wed, Jan 20, 2021 at 4:53 AM Michael Walle > > > > >> > >> >> wrote: > > > > >> > >> >> > > > > > >> > >> >> > fw_devlink will defer the probe until all suppliers are ready. We can't > > > > >> > >> >> > use builtin_platform_driver_probe() because it doesn't retry after probe > > > > >> > >> >> > deferral. Convert it to builtin_platform_driver(). > > > > >> > >> >> > > > > >> > >> >> If builtin_platform_driver_probe() doesn't work with fw_devlink, then > > > > >> > >> >> shouldn't it be fixed or removed? > > > > >> > >> > > > > > >> > >> > I was actually thinking about this too. The problem with fixing > > > > >> > >> > builtin_platform_driver_probe() to behave like > > > > >> > >> > builtin_platform_driver() is that these probe functions could be > > > > >> > >> > marked with __init. But there are also only 20 instances of > > > > >> > >> > builtin_platform_driver_probe() in the kernel: > > > > >> > >> > $ git grep ^builtin_platform_driver_probe | wc -l > > > > >> > >> > 20 > > > > >> > >> > > > > > >> > >> > So it might be easier to just fix them to not use > > > > >> > >> > builtin_platform_driver_probe(). > > > > >> > >> > > > > > >> > >> > Michael, > > > > >> > >> > > > > > >> > >> > Any chance you'd be willing to help me by converting all these to > > > > >> > >> > builtin_platform_driver() and delete builtin_platform_driver_probe()? > > > > >> > >> > > > > >> > >> If it just moving the probe function to the _driver struct and > > > > >> > >> remove the __init annotations. I could look into that. > > > > >> > > > > > > >> > > Yup. That's pretty much it AFAICT. > > > > >> > > > > > > >> > > builtin_platform_driver_probe() also makes sure the driver doesn't ask > > > > >> > > for async probe, etc. But I doubt anyone is actually setting async > > > > >> > > flags and still using builtin_platform_driver_probe(). > > > > >> > > > > > >> > Hasn't module_platform_driver_probe() the same problem? And there > > > > >> > are ~80 drivers which uses that. > > > > >> > > > > >> Yeah. The biggest problem with all of these is the __init markers. > > > > >> Maybe some familiar with coccinelle can help? > > > > > > > > > > And dropping them will increase memory usage. > > > > > > > > Although I do have the changes for the builtin_platform_driver_probe() > > > > ready, I don't think it makes much sense to send these unless we agree > > > > on the increased memory footprint. While there are just a few > > > > builtin_platform_driver_probe() and memory increase _might_ be > > > > negligible, there are many more module_platform_driver_probe(). > > > > > > While it's good to drop code that'll not be used past kernel init, the > > > module_platform_driver_probe() is going even more extreme. It doesn't > > > even allow deferred probe (well before kernel init is done). I don't > > > think that behavior is right and that's why we should delete it. Also, > > > > This construct is typically used for builtin hardware for which the > > dependencies are registered very early, and thus known to probe at > > first try (if present). > > > > > I doubt if any of these probe functions even take up 4KB of memory. > > > > How many 4 KiB pages do you have in a system with 10 MiB of SRAM? > > How many can you afford to waste? > > There are only a few instances of this macro in the kernel. How many $ git grep -lw builtin_platform_driver_probe | wc -l 21 $ git grep -lw module_platform_driver_probe | wc -l 86 + the ones that haven't been converted to the above yet: $ git grep -lw platform_driver_probe | wc -l 58 > of those actually fit the description above? We can probably just > check the DT? What do you mean by checking the DT? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0F1DC433E0 for ; Wed, 27 Jan 2021 07:46:05 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7A1320679 for ; Wed, 27 Jan 2021 07:46:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7A1320679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DQbJB3NT0zDqjv for ; Wed, 27 Jan 2021 18:46:02 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.210.46; helo=mail-ot1-f46.google.com; envelope-from=geert.uytterhoeven@gmail.com; receiver=) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4DQbFv1qB8zDqbW for ; Wed, 27 Jan 2021 18:44:00 +1100 (AEDT) Received: by mail-ot1-f46.google.com with SMTP id s2so834320otp.5 for ; Tue, 26 Jan 2021 23:44:00 -0800 (PST) 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=x0dGkBBCOjjdRO5NeNomyXurGTss4C1Z8jAZPD1nTr0=; b=R4Qb4ZebzrP/B/2KlvJI2/rX23Jr6CHMt4sEP1ucnDYae6tLYruJxAXE5QKkYL5TWO MgnkTQPiO7OcvakqIbTO1hKpe6wovZXZfezXi6uGC/FuzqOa/YYU7yaeGFig9y3ZdAPl ETYfBKoYkiWfcVdG3TQ7Lj28uJDZMRXZKMMdH7FGPmAzMrT9JTk23dyJB8ENfAe/WjmU sPhIieASNG+6qqxg8r3qggJL3oDaDwD7A+8A3uBMd/XM7o5FzLDKWEBCq5cB5bvn33/J +8BrSDIbBQxqTN/JWv6+kMC43A/yOXtkzafu2VfmBfuPZOZC9ceFCWeIJSGGOfuWokoC 7nWw== X-Gm-Message-State: AOAM532EcacNHTHCM7zocxBwqhtZVdIknJboghkUAIGN56NGr6BtULU0 0hTOgZcXSAse0/nXFnAQ2EKkPU1rN4gFtwcqmvE= X-Google-Smtp-Source: ABdhPJytEiLX+kMjV4Ea2i2rFfKnTCKJB2DxU0jLTV+BpUesrQ9gHru0x+sIRyJPwSKOmvFMZ1Gze3L0qvmdO0bLsr0= X-Received: by 2002:a9d:c01:: with SMTP id 1mr6698124otr.107.1611733436883; Tue, 26 Jan 2021 23:43:56 -0800 (PST) MIME-Version: 1.0 References: <20210120105246.23218-1-michael@walle.cc> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 27 Jan 2021 08:43:45 +0100 Message-ID: Subject: Re: [PATCH] PCI: dwc: layerscape: convert to builtin_platform_driver() To: Saravana Kannan Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roy Zang , Lorenzo Pieralisi , PCI , LKML , Minghuan Lian , Michael Walle , linux-arm-kernel , Greg Kroah-Hartman , Bjorn Helgaas , linuxppc-dev , Mingkai Hu Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Saravana, On Wed, Jan 27, 2021 at 1:44 AM Saravana Kannan wrote: > On Tue, Jan 26, 2021 at 12:50 AM Geert Uytterhoeven > wrote: > > On Mon, Jan 25, 2021 at 11:42 PM Saravana Kannan wrote: > > > On Mon, Jan 25, 2021 at 11:49 AM Michael Walle wrote: > > > > Am 2021-01-21 12:01, schrieb Geert Uytterhoeven: > > > > > On Thu, Jan 21, 2021 at 1:05 AM Saravana Kannan > > > > > wrote: > > > > >> On Wed, Jan 20, 2021 at 3:53 PM Michael Walle > > > > >> wrote: > > > > >> > Am 2021-01-20 20:47, schrieb Saravana Kannan: > > > > >> > > On Wed, Jan 20, 2021 at 11:28 AM Michael Walle > > > > >> > > wrote: > > > > >> > >> > > > > >> > >> [RESEND, fat-fingered the buttons of my mail client and converted > > > > >> > >> all CCs to BCCs :(] > > > > >> > >> > > > > >> > >> Am 2021-01-20 20:02, schrieb Saravana Kannan: > > > > >> > >> > On Wed, Jan 20, 2021 at 6:24 AM Rob Herring wrote: > > > > >> > >> >> > > > > >> > >> >> On Wed, Jan 20, 2021 at 4:53 AM Michael Walle > > > > >> > >> >> wrote: > > > > >> > >> >> > > > > > >> > >> >> > fw_devlink will defer the probe until all suppliers are ready. We can't > > > > >> > >> >> > use builtin_platform_driver_probe() because it doesn't retry after probe > > > > >> > >> >> > deferral. Convert it to builtin_platform_driver(). > > > > >> > >> >> > > > > >> > >> >> If builtin_platform_driver_probe() doesn't work with fw_devlink, then > > > > >> > >> >> shouldn't it be fixed or removed? > > > > >> > >> > > > > > >> > >> > I was actually thinking about this too. The problem with fixing > > > > >> > >> > builtin_platform_driver_probe() to behave like > > > > >> > >> > builtin_platform_driver() is that these probe functions could be > > > > >> > >> > marked with __init. But there are also only 20 instances of > > > > >> > >> > builtin_platform_driver_probe() in the kernel: > > > > >> > >> > $ git grep ^builtin_platform_driver_probe | wc -l > > > > >> > >> > 20 > > > > >> > >> > > > > > >> > >> > So it might be easier to just fix them to not use > > > > >> > >> > builtin_platform_driver_probe(). > > > > >> > >> > > > > > >> > >> > Michael, > > > > >> > >> > > > > > >> > >> > Any chance you'd be willing to help me by converting all these to > > > > >> > >> > builtin_platform_driver() and delete builtin_platform_driver_probe()? > > > > >> > >> > > > > >> > >> If it just moving the probe function to the _driver struct and > > > > >> > >> remove the __init annotations. I could look into that. > > > > >> > > > > > > >> > > Yup. That's pretty much it AFAICT. > > > > >> > > > > > > >> > > builtin_platform_driver_probe() also makes sure the driver doesn't ask > > > > >> > > for async probe, etc. But I doubt anyone is actually setting async > > > > >> > > flags and still using builtin_platform_driver_probe(). > > > > >> > > > > > >> > Hasn't module_platform_driver_probe() the same problem? And there > > > > >> > are ~80 drivers which uses that. > > > > >> > > > > >> Yeah. The biggest problem with all of these is the __init markers. > > > > >> Maybe some familiar with coccinelle can help? > > > > > > > > > > And dropping them will increase memory usage. > > > > > > > > Although I do have the changes for the builtin_platform_driver_probe() > > > > ready, I don't think it makes much sense to send these unless we agree > > > > on the increased memory footprint. While there are just a few > > > > builtin_platform_driver_probe() and memory increase _might_ be > > > > negligible, there are many more module_platform_driver_probe(). > > > > > > While it's good to drop code that'll not be used past kernel init, the > > > module_platform_driver_probe() is going even more extreme. It doesn't > > > even allow deferred probe (well before kernel init is done). I don't > > > think that behavior is right and that's why we should delete it. Also, > > > > This construct is typically used for builtin hardware for which the > > dependencies are registered very early, and thus known to probe at > > first try (if present). > > > > > I doubt if any of these probe functions even take up 4KB of memory. > > > > How many 4 KiB pages do you have in a system with 10 MiB of SRAM? > > How many can you afford to waste? > > There are only a few instances of this macro in the kernel. How many $ git grep -lw builtin_platform_driver_probe | wc -l 21 $ git grep -lw module_platform_driver_probe | wc -l 86 + the ones that haven't been converted to the above yet: $ git grep -lw platform_driver_probe | wc -l 58 > of those actually fit the description above? We can probably just > check the DT? What do you mean by checking the DT? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC92AC433E0 for ; Wed, 27 Jan 2021 07:45:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97E8A20679 for ; Wed, 27 Jan 2021 07:45:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97E8A20679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dnjB37wyFv3Oot2ZnjUy4iaxsR7QKrwCTLciw/kwLaI=; b=e+qfgHdHJJ8YoxXQjE4qMT/+n DSF6RR6NBZYIJkPZNbQykkmv34/Idi6qBagqpGGdxrp4TzFc4UE3Gc/bT0BGi8AGomikohn6tRbEl qqf22d0/Du6GFOg3PZCa/AM6JVkA5nW+kR/l0sWzT3PBqOrneP040VTKOpNV//Fq3XKk6qncqqSaV fYfqGCNtMZEQJV9Wh2JkCy00TgHF6IOHyeZO98vItRz4JqdT9mftclBW6nNe9xxDGRXVuiQQaBfNv 7ZhqUilCo9bE/2+o+hvMTbLJoyjd10BlUBQf3X6/Fw5jCtnPVKl9DM5wd8GrLeTRg+HTf5dYuOBe5 wXXsbu16A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4fUj-0008TX-0R; Wed, 27 Jan 2021 07:44:05 +0000 Received: from mail-ot1-f53.google.com ([209.85.210.53]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4fUf-0008Sm-9M for linux-arm-kernel@lists.infradead.org; Wed, 27 Jan 2021 07:44:02 +0000 Received: by mail-ot1-f53.google.com with SMTP id v1so818086ott.10 for ; Tue, 26 Jan 2021 23:43:57 -0800 (PST) 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=x0dGkBBCOjjdRO5NeNomyXurGTss4C1Z8jAZPD1nTr0=; b=MoJR05qh5l13NzF1zuAGWOlZFT/iSRtiROr2wPbNZQgl9kdVjYkEyw6zArG/0KF98n v4qX8HYXy+m8Uki/lpmHlOxkd9ti44mdgxDUVHUahEU00gnGpqqBHgMt6JLzHcERZx4w 05jvYF56+YD/JkKLxWF32+m6QZgWcQgsvtnQQVFUE7QnAA8mdZkYJSiblvW7OAGtuwK2 bBB6VSQLEiD971CLnjcDu4feOsOGcGOUR1l2dljnCU71IFmHgdi/4AMf3VleOAGwwUUx PGOGNipOAEyhY779twRcuXvWQOzX0UAswLPL65OUIlylnOr+celMPcRNjy09bBaL7cMy 2vXg== X-Gm-Message-State: AOAM533gwaElsjls+NsOkD2sZU8FPiOgCR7WXJFc+9ViVyY1ClumtOJo uuH7UhGCrMFDSGlYtNNmfotcJoZ1++sV67PoeK4= X-Google-Smtp-Source: ABdhPJytEiLX+kMjV4Ea2i2rFfKnTCKJB2DxU0jLTV+BpUesrQ9gHru0x+sIRyJPwSKOmvFMZ1Gze3L0qvmdO0bLsr0= X-Received: by 2002:a9d:c01:: with SMTP id 1mr6698124otr.107.1611733436883; Tue, 26 Jan 2021 23:43:56 -0800 (PST) MIME-Version: 1.0 References: <20210120105246.23218-1-michael@walle.cc> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 27 Jan 2021 08:43:45 +0100 Message-ID: Subject: Re: [PATCH] PCI: dwc: layerscape: convert to builtin_platform_driver() To: Saravana Kannan X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210127_024401_332915_532497FA X-CRM114-Status: GOOD ( 40.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roy Zang , Lorenzo Pieralisi , PCI , LKML , Minghuan Lian , Michael Walle , linux-arm-kernel , Greg Kroah-Hartman , Bjorn Helgaas , linuxppc-dev , Mingkai Hu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Saravana, On Wed, Jan 27, 2021 at 1:44 AM Saravana Kannan wrote: > On Tue, Jan 26, 2021 at 12:50 AM Geert Uytterhoeven > wrote: > > On Mon, Jan 25, 2021 at 11:42 PM Saravana Kannan wrote: > > > On Mon, Jan 25, 2021 at 11:49 AM Michael Walle wrote: > > > > Am 2021-01-21 12:01, schrieb Geert Uytterhoeven: > > > > > On Thu, Jan 21, 2021 at 1:05 AM Saravana Kannan > > > > > wrote: > > > > >> On Wed, Jan 20, 2021 at 3:53 PM Michael Walle > > > > >> wrote: > > > > >> > Am 2021-01-20 20:47, schrieb Saravana Kannan: > > > > >> > > On Wed, Jan 20, 2021 at 11:28 AM Michael Walle > > > > >> > > wrote: > > > > >> > >> > > > > >> > >> [RESEND, fat-fingered the buttons of my mail client and converted > > > > >> > >> all CCs to BCCs :(] > > > > >> > >> > > > > >> > >> Am 2021-01-20 20:02, schrieb Saravana Kannan: > > > > >> > >> > On Wed, Jan 20, 2021 at 6:24 AM Rob Herring wrote: > > > > >> > >> >> > > > > >> > >> >> On Wed, Jan 20, 2021 at 4:53 AM Michael Walle > > > > >> > >> >> wrote: > > > > >> > >> >> > > > > > >> > >> >> > fw_devlink will defer the probe until all suppliers are ready. We can't > > > > >> > >> >> > use builtin_platform_driver_probe() because it doesn't retry after probe > > > > >> > >> >> > deferral. Convert it to builtin_platform_driver(). > > > > >> > >> >> > > > > >> > >> >> If builtin_platform_driver_probe() doesn't work with fw_devlink, then > > > > >> > >> >> shouldn't it be fixed or removed? > > > > >> > >> > > > > > >> > >> > I was actually thinking about this too. The problem with fixing > > > > >> > >> > builtin_platform_driver_probe() to behave like > > > > >> > >> > builtin_platform_driver() is that these probe functions could be > > > > >> > >> > marked with __init. But there are also only 20 instances of > > > > >> > >> > builtin_platform_driver_probe() in the kernel: > > > > >> > >> > $ git grep ^builtin_platform_driver_probe | wc -l > > > > >> > >> > 20 > > > > >> > >> > > > > > >> > >> > So it might be easier to just fix them to not use > > > > >> > >> > builtin_platform_driver_probe(). > > > > >> > >> > > > > > >> > >> > Michael, > > > > >> > >> > > > > > >> > >> > Any chance you'd be willing to help me by converting all these to > > > > >> > >> > builtin_platform_driver() and delete builtin_platform_driver_probe()? > > > > >> > >> > > > > >> > >> If it just moving the probe function to the _driver struct and > > > > >> > >> remove the __init annotations. I could look into that. > > > > >> > > > > > > >> > > Yup. That's pretty much it AFAICT. > > > > >> > > > > > > >> > > builtin_platform_driver_probe() also makes sure the driver doesn't ask > > > > >> > > for async probe, etc. But I doubt anyone is actually setting async > > > > >> > > flags and still using builtin_platform_driver_probe(). > > > > >> > > > > > >> > Hasn't module_platform_driver_probe() the same problem? And there > > > > >> > are ~80 drivers which uses that. > > > > >> > > > > >> Yeah. The biggest problem with all of these is the __init markers. > > > > >> Maybe some familiar with coccinelle can help? > > > > > > > > > > And dropping them will increase memory usage. > > > > > > > > Although I do have the changes for the builtin_platform_driver_probe() > > > > ready, I don't think it makes much sense to send these unless we agree > > > > on the increased memory footprint. While there are just a few > > > > builtin_platform_driver_probe() and memory increase _might_ be > > > > negligible, there are many more module_platform_driver_probe(). > > > > > > While it's good to drop code that'll not be used past kernel init, the > > > module_platform_driver_probe() is going even more extreme. It doesn't > > > even allow deferred probe (well before kernel init is done). I don't > > > think that behavior is right and that's why we should delete it. Also, > > > > This construct is typically used for builtin hardware for which the > > dependencies are registered very early, and thus known to probe at > > first try (if present). > > > > > I doubt if any of these probe functions even take up 4KB of memory. > > > > How many 4 KiB pages do you have in a system with 10 MiB of SRAM? > > How many can you afford to waste? > > There are only a few instances of this macro in the kernel. How many $ git grep -lw builtin_platform_driver_probe | wc -l 21 $ git grep -lw module_platform_driver_probe | wc -l 86 + the ones that haven't been converted to the above yet: $ git grep -lw platform_driver_probe | wc -l 58 > of those actually fit the description above? We can probably just > check the DT? What do you mean by checking the DT? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel