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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 0DB2AC433E0 for ; Wed, 10 Mar 2021 09:40:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC10764F70 for ; Wed, 10 Mar 2021 09:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231856AbhCJJkU (ORCPT ); Wed, 10 Mar 2021 04:40:20 -0500 Received: from mga04.intel.com ([192.55.52.120]:6155 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232408AbhCJJju (ORCPT ); Wed, 10 Mar 2021 04:39:50 -0500 IronPort-SDR: C4f5DLdSyxCkLrTtPhAJgJ8Civ67XNm36L1FrImMnh8STTo/rEIWr2S62vz/zV2Fvz8WhMt5M4 uYMs2nTLyjAA== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="186047610" X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="186047610" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 01:39:49 -0800 IronPort-SDR: oQuA0EBLbbdzY/MX4bQ/azPSyY7pd4xKepSD2fF1WxCuRa8lkJEHtyo1IlDcOPdl6J3z3VszjQ p1OWrV5IjhnQ== X-IronPort-AV: E=Sophos;i="5.81,237,1610438400"; d="scan'208";a="410119546" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 01:39:45 -0800 Received: by lahna (sSMTP sendmail emulation); Wed, 10 Mar 2021 11:39:42 +0200 Date: Wed, 10 Mar 2021 11:39:42 +0200 From: Mika Westerberg To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , Lukas Wunner , Mario Limonciello , Christian Kellner , Benson Leung , Prashant Malani , Diego Rivas Subject: Re: [PATCH 3/3] thunderbolt: Expose more details about USB 3.x and DisplayPort tunnels Message-ID: <20210310093942.GD2542@lahna.fi.intel.com> References: <20210309134818.63118-1-mika.westerberg@linux.intel.com> <20210309134818.63118-4-mika.westerberg@linux.intel.com> <20210310075444.GB2542@lahna.fi.intel.com> <20210310092155.GC2542@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, Mar 10, 2021 at 10:34:38AM +0100, Greg Kroah-Hartman wrote: > On Wed, Mar 10, 2021 at 11:21:55AM +0200, Mika Westerberg wrote: > > Hi, > > > > On Wed, Mar 10, 2021 at 09:53:31AM +0100, Greg Kroah-Hartman wrote: > > > On Wed, Mar 10, 2021 at 09:54:44AM +0200, Mika Westerberg wrote: > > > > > > +static void tb_add_tunnel(struct tb *tb, struct tb_tunnel *tunnel) > > > > > > +{ > > > > > > + struct tb_switch *sw = tunnel->dst_port->sw; > > > > > > + struct tb_cm *tcm = tb_priv(tb); > > > > > > + > > > > > > + if (tb_tunnel_is_usb3(tunnel)) { > > > > > > + sw->usb3++; > > > > > > + } else if (tb_tunnel_is_dp(tunnel)) { > > > > > > + sw->dp++; > > > > > > + /* Inform userspace about DP tunneling change */ > > > > > > + kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); > > > > > > > > > > What really "changed" here about this device that userspace now needs to > > > > > know about it? > > > > > > > > DisplayPort tunnel came up, so the "dp" attribute value changed. > > > > > > > > I'm not entirely sure we need to notify the userspace from changes like > > > > these, though. We do this when PCIe tunnel comes up already so this kind > > > > of follows that (and USB 3.x tunnel is always created at the same time > > > > the device itself is announced so does not require any change event). > > > > > > > > > > + } > > > > > > + > > > > > > + list_add_tail(&tunnel->list, &tcm->tunnel_list); > > > > > > +} > > > > > > + > > > > > > +static void tb_remove_tunnel(struct tb_tunnel *tunnel) > > > > > > +{ > > > > > > + struct tb_switch *sw = tunnel->dst_port->sw; > > > > > > + > > > > > > + if (tb_tunnel_is_usb3(tunnel) && sw->usb3) { > > > > > > + sw->usb3--; > > > > > > + } else if (tb_tunnel_is_dp(tunnel) && sw->dp) { > > > > > > + sw->dp--; > > > > > > + kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); > > > > > > > > > > Same here, what causes tunnels to be added or removed? > > > > > > > > Here the opposite, a DisplayPort tunnel was torn down so the "dp" > > > > attribute changed. > > > > > > Did just the value in the attribute change, or did the visability of > > > attributes change? > > > > The value changes. > > > > > And if it is just the value, who is going to care about this value? Is > > > userspace going to want to know this type of change? What causes this > > > to change in the first place (physical event? Virtual event? Something > > > else?) > > > > It is physical event. Typically this happens when user plugs a monitor > > to a Thunderbolt dock, or plugs it out. This value changes accordingly. > > So are there other events that show up to userspace when this happens? > Like devices added/removed? If so, then sending a kobject change event > here doesn't make much sense as userspace can go re-read this based on > the fact that other things changed. >From Thunderbolt driver side in this event (monitor plugged in/out) there are no new devices added or removed. It all happens to the device that already exists (the dock for instance). > > The caring part is the userspace application, I think bolt in case of > > non-ChromeOS distro and the ChromeOS equivalent but I'm not sure if this > > is something they find useful or not. That's why I have Cc'd (hopefully > > all) the people who work with the userspace side :) > > What userspace apps read this file today in any Linux distro? None at the moment. This is completely new attribute.