Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp2196650pja; Thu, 26 Mar 2020 11:11:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtaVgAhNHSEs++TlzhPqb5mAAi3rFxeEEbdhBzuJKcbXp8oWtEM3dMmz3Paqh8fkKnVgr8i X-Received: by 2002:a9d:5e86:: with SMTP id f6mr3747020otl.238.1585246314311; Thu, 26 Mar 2020 11:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585246314; cv=none; d=google.com; s=arc-20160816; b=bjYhSpe8opbGDcCh4fv0yDCgGXCXLz1hx1o5hDoleqMw3089FH9k8k8n0X72dADDlA hyf2OlQoKQ8XedxMVgyfuz7z0sOqlq+KxUrz9uazy8rqBH80v5IpTueDqhLfnH04Cur4 8qSpCrEZesWStvEswdX0hGsac0gP+EVOGLuwcp1O2RMdf+8/fMbyJ3GGK4DvY15Vd69g bEYGYpiqe8tnOiWdFdcsNg9MLKzTuDlZS/KeJ8ebjjnJX4X7m/vXsYnD/kbsHRqDkK8T tPMip5dMUEfVgH0b0BSoHaCIftuTcWtWBZz79+onZN1hnVq1GNSDOThdeI5l/DV1LdWF d5DQ== 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=U23zV80H/fWBc+iRgD1UjAaCfCC2dZVzJMDMBndseY4=; b=rd9h72pYiD73b+tCAGh8aXDmn5HSWFaURUdt3LxpZS1YRWAwG/LqdlA+n5t6+jZqU1 lCZU0aaLAP9Rqr630eGC0oJweWUVsZuMWflWU4MMhZLMHiGe31v4r4z/ThtdCuyuPPi0 FOYVD4f7mXevqifV/jgXHmOcYYqKNvK/3HCHkM+U3UAvXDiyEEo6YqPlRlJviiXx3jNt 60YPfM6atFq2qd+pI2ZdDUGc74BAtMTtSNOz8aTi14fMceVK1wfe5j4G2PAtLORQBLL1 YQ0WAP9hb6LqXEuh+9XR+wK6r+wYNKT4TIz2ZT6ExgF/g3hHnYSnRJP8+g0qAH0UxmRG m2VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YQHUd4g2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15si1280508ooq.37.2020.03.26.11.11.40; Thu, 26 Mar 2020 11:11:54 -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=@google.com header.s=20161025 header.b=YQHUd4g2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727865AbgCZSJB (ORCPT + 99 others); Thu, 26 Mar 2020 14:09:01 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:38632 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbgCZSJB (ORCPT ); Thu, 26 Mar 2020 14:09:01 -0400 Received: by mail-ot1-f65.google.com with SMTP id t28so6882339ott.5 for ; Thu, 26 Mar 2020 11:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U23zV80H/fWBc+iRgD1UjAaCfCC2dZVzJMDMBndseY4=; b=YQHUd4g2qLXtQjXBE4UkMWhIR8nDbvEUaciILNOK1DDGTPkVwxPnjuXXEl+PQHbM/1 y6LDzWG05v6UkDFD+hMNUXbok89dYzFWteDm2vjHupA5u+YtneTqEU/fVPzR8E2nTUZ8 66uNDVPrLuINvhQ8gOBxGfgdzbAs3VvT6YKpRtj30g+Zjzz8nXk+owbQRhHorhxFTmVZ JIwHb/KAKnILqy/tO+qHlvAZde4hejp45M8JGZWeHHHHfQO45fI7cyUT1Q5iH6ZbiFhu pJ49aMWlxdim62oSWBo3EI1E9poJSoNy/2Z0hdT7sSaBj/1L3nU1I2G8IPtyJeA6+sqi K6Rw== 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=U23zV80H/fWBc+iRgD1UjAaCfCC2dZVzJMDMBndseY4=; b=l0Wmo7FsV8lZ3FNLDtY5okLP/do4i4vU/IGkAaYooAkwObh3+7moDnEX0lHdXFUJqa 4Mr5O2E4N3gMibCQcCaQyo8tsB6SBu1kmqjQrVh7sgdtwA/TPWFfHj6RGmMQZ2WLInld n1RrGNp9QzUiRt/iW9pEHm5n+jZnZ4whu9elJNcXmnDh5FKgIdHPW+iDVQYsPPAigRKQ xFbVMvQq2pm29Js9Utr+x96TP8SvfECHYoJFzOWJ5n7tJV4ULKIDtX/4JBA7qmTfh78t oLQEHFmTxdQ7qX/y3/XI0FGxhNXkjmJo0nkMnZN6R6hq716nTCTVqIgbhJkohaMADuYY Pwgg== X-Gm-Message-State: ANhLgQ3IviGygA7rP2OR6leeBRJIjQhYdpeRznlYvZ54krjWTLLNE5KE MFxDfbo0XBnvEk1fQWv9gDffZPVSA9DiOpsZrHavog== X-Received: by 2002:a4a:4190:: with SMTP id x138mr6179666ooa.35.1585246139794; Thu, 26 Mar 2020 11:08:59 -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: From: Saravana Kannan Date: Thu, 26 Mar 2020 11:08:23 -0700 Message-ID: Subject: Re: [tip: timers/core] clocksource/drivers/timer-probe: Avoid creating dead devices To: Rob Herring Cc: Thomas Gleixner , 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 8:02 AM Rob Herring wrote: > > 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. Since most drivers don't need the struct device, my patch sets the flag in the timer core. And for the few exception cases where the device is needed, we can clear the flag in the driver. That'll reduce the number of places mucking with OF_POPULATED. Does this seem okay to you? > 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. Keep in mind that struct devices cost more than one struct device of memory. They also create a bunch of sysfs nodes, uevents, etc. > > 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. I agree with this. I'm definitely not asking to create a node just because we want another struct device. > If we decided to > add a node now, we'd still have to support the old DT for backwards > compatibility. Right, I agree it's too late to fix this DT for vexpress-sysreg now. > 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. If we have a timer MFD, it'd technically consume a fixed-clock and not be empty. vexpress-sysreg just assumes the clock is 24 MHz right now. My point about the vexpress DT nodes being weird is not about Linux devices, rather it's that: 1. It's already a MFD 2. Most of the functions are separated clearly into their functional device nodes 3. However, the timer functionality is combined with the parent MFD device when the parent MFD device implements a completely separate function (gpio?). Why? If one wants to split out the functions, do it fully. If one wants it all under one mega driver (ugh!) then combine it all. Going halfway causes these weird issues. That's my complaint about how the DT layout is for this device. Having said all that, I'd rather manipulate the OF_POPULATED flag than break DT backward compatibility at this point. But in general, I think we should try to reject two separate drivers claiming to be compatible with the same device and expecting to work at the same time. That's just weird. -Saravana