Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1830486ybb; Thu, 26 Mar 2020 08:06:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vttUt70uG+tyyfj0zYpfEGxw8H/Zsj5DSOpNSjy0V7hSCHHePoUjlLSqFSkWakDjZAzvzuD X-Received: by 2002:aca:5a56:: with SMTP id o83mr333413oib.134.1585235203822; Thu, 26 Mar 2020 08:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585235203; cv=none; d=google.com; s=arc-20160816; b=mUQrquceJvo4XvkJE641V4rzDYjhW1OTfMxGWg3XcNtW1Ph0z29oGKBd7D97jjTgAX 1/QVk7scIPVCXj+tfWwwPxrWp/fRT/NSBsMncZ6V14LWFwFYi2lAYvoCb3BmeC6P/I+o UeMbEKZ6/D6z4jFIFyqnDeWZPcy3mwichVr+BM0dzyKUYEmsfDjBMr1s3xvlViWc3VAL RDxElyLQigqammJSXIGTWjte0BqOr3aEStpWfgFexTDfDU6MnEjTj/04MgH/q2gQgJL6 85x7MXCanHY5NaPIqwgJBakV60NxBr3TrsZecrdw/cV+jKYn8whDOZT9UFZsb/TwkW5V 9ApQ== 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=aFhpJni6/CsdULCawfOYAw4NLfGaTvWSDBG0TOaDnoM=; b=GiWHJhhFDMDOg2/EgP06eDh2kIUmec84rnjScp+mQ7LW34qFfBQRJE8ETYzBGrUTWa rU0zrOujYePH/IvZ68KHXIJh0U4ywuDIVp0K/n3BOoCZsMQ6pcIjU8i7rigAv4Lhah3+ bmcScUL7fNTdHIGpMl4OI0TvlqvKrMaWShm5jLx04aEjnqx5fvlL1/n4paIqpxHUGVC/ odV9P9MRi6seVy0Z1X02ZPKSwrVoUT2w94X90xehEJHzFl4ugE4FfImUsDucMKPHEoaB AvuX7hEdIz+11zgiTg/2b4L8YevYPruYITXmkEczWX6CNqxii36B4AEKUI4e2dtHBJbN 8t5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OHYRQTyL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si1056592oij.237.2020.03.26.08.06.17; Thu, 26 Mar 2020 08:06:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OHYRQTyL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727815AbgCZPCq (ORCPT + 99 others); Thu, 26 Mar 2020 11:02:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbgCZPCq (ORCPT ); Thu, 26 Mar 2020 11:02:46 -0400 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E1F6620737; Thu, 26 Mar 2020 15:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585234965; bh=aFhpJni6/CsdULCawfOYAw4NLfGaTvWSDBG0TOaDnoM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OHYRQTyLSsYSPoUl6SZEiyMAUR6rTUhuXiGvPh/3UoTTvgCtJnfcGU+x1sMZPRZP9 0v64ZGV9OGSx58uesR2IQH5ak0NVdTL4XRaf30mRrnGdv/JCXyajGMKha5zai5OlWO bf+2QL9mggVeVI5hp8O0lR2susQJZAYVFNLieWRs= Received: by mail-qv1-f47.google.com with SMTP id m2so3047343qvu.13; Thu, 26 Mar 2020 08:02:44 -0700 (PDT) X-Gm-Message-State: ANhLgQ20TV5JWDmEdlp9YA/0/lqQ+B/WrlY4+uaMt6QONw/ZcVIvzf0d 3tQ7NmpO+Dk6bCyjXZEmwBHM5fEAjCn+7BCr2w== X-Received: by 2002:ad4:4829:: with SMTP id h9mr8086052qvy.135.1585234963992; Thu, 26 Mar 2020 08:02:43 -0700 (PDT) MIME-Version: 1.0 References: <20200111052125.238212-1-saravanak@google.com> <158460766637.28353.11325960928759668587.tip-bot2@tip-bot2> <20200324175955.GA16972@arm.com> <87lfnoxg2a.fsf@nanos.tec.linutronix.de> <87imirxv57.fsf@nanos.tec.linutronix.de> In-Reply-To: <87imirxv57.fsf@nanos.tec.linutronix.de> From: Rob Herring Date: Thu, 26 Mar 2020 09:02:32 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [tip: timers/core] clocksource/drivers/timer-probe: Avoid creating dead devices To: Thomas Gleixner , Saravana Kannan Cc: Ionela Voinescu , LKML , Daniel Lezcano , linux-tip-commits@vger.kernel.org, x86 , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , Jon Hunter , Pawel Moll , Mark Rutland 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 On Thu, Mar 26, 2020 at 4:34 AM Thomas Gleixner wrote: > > Saravana Kannan writes: > > On Wed, Mar 25, 2020 at 2:47 PM Thomas Gleixner wrote: > > > >> Saravana Kannan writes: > >> > On Tue, Mar 24, 2020 at 11:34 AM Saravana Kannan wrote: > >> > I took a closer look. So two different drivers [1] [2] are saying they > >> > know how to handle "arm,vexpress-sysreg" and are expecting to run at > >> > the same time. That seems a bit unusual to me. I wonder if this is a > >> > violation of the device-driver model because this expectation would > >> > never be allowed if these device drivers were actual drivers > >> > registered with driver-core. But that's a discussion for another time. > >> > > >> > To fix this issue you are facing, this patch should work: > >> > https://lore.kernel.org/lkml/20200324195302.203115-1-saravanak@google.com/T/#u > >> > >> Sorry, that's not a fix. That's a crude hack. > > > > If device nodes are being handled by drivers without binding a driver > > to struct devices, then not setting OF_POPULATED is wrong. So the > > original patch sets it. There are also very valid reasons for allowing > > OF_POPULATED to be cleared by a driver as discussed here [1]. > > > > The approach of the original patch (setting the flag and letting the > > driver sometimes clear it) is also followed by many other frameworks > > like irq, clk, i2c, etc. Even ingenic-timer.c already does it for the > > exact same reason. > > > > So, why is the vexpress fix a crude hack? > > If it's the right thing to do and accepted by the DT folks, then the > changelog should provide a proper explanation for it. The one you > provided just baffles me. Plus the clearing of the flag really needs a > big fat comment. IMO, commit 4f41fe386a946 should be reverted and be done with it. There's no way the timer core can know whether a specific node should be scanned or not. If you really want to avoid a struct device, then set OF_POPULATED in specific timer drivers. But I'd rather not see more places mucking with OF_POPULATED. It's really only bus code that should be touching it. Is having a struct device really a problem? If we want to save memory usage, I have some ideas that would save much more than 1 or 2 struct devices. > It still does not make any sense to me. > > arm,vexpress-sysreg is a MFD device, so can the ARM people please > explain, why the sched clock part is not just another MFD sub-device or > simply has it's own DT match? The issue is DT nodes and Linux drivers aren't necessarily 1-1. That would be nice, but hardware is messy and DT doesn't abstract that away. If we tried to always make things 1-1, then if/when the Linux driver structure changes we'd have to change the DT. If we decided to add a node now, we'd still have to support the old DT for backwards compatibility. We also have to consider the structure for another OS may be different. Generally, if I see a node with a compatible only it gets NAKed as that's a sure sign of someone just trying to bind a driver and not describing the h/w. We only do MFD sub-devices if those devices provide or consume other DT resources. Rob