From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbcEaMoG (ORCPT ); Tue, 31 May 2016 08:44:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:18907 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbcEaMoB (ORCPT ); Tue, 31 May 2016 08:44:01 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,395,1459839600"; d="scan'208";a="711555893" Date: Tue, 31 May 2016 15:43:56 +0300 From: Heikki Krogerus To: Oliver Neukum Cc: Andy Shevchenko , Rajaram R , Felipe Balbi , Mathias Nyman , Greg KH , Guenter Roeck , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [RFC PATCHv2] usb: USB Type-C Connector Class Message-ID: <20160531124355.GC10084@kuha.fi.intel.com> References: <1463661894-22820-1-git-send-email-heikki.krogerus@linux.intel.com> <20160530131951.GA13055@kuha.fi.intel.com> <1464616767.5364.5.camel@suse.com> <20160531083121.GA10084@kuha.fi.intel.com> <1464684509.10800.16.camel@suse.com> <20160531120901.GB10084@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160531120901.GB10084@kuha.fi.intel.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 31, 2016 at 03:09:01PM +0300, Heikki Krogerus wrote: > On Tue, May 31, 2016 at 10:48:29AM +0200, Oliver Neukum wrote: > > On Tue, 2016-05-31 at 11:31 +0300, Heikki Krogerus wrote: > > > Hi Oliver, > > > > > > On Mon, May 30, 2016 at 03:59:27PM +0200, Oliver Neukum wrote: > > > > On Mon, 2016-05-30 at 16:19 +0300, Heikki Krogerus wrote: > > > > > Hi guys, > > > > > > > > > > I'm attaching a diff instead of full v3. I'm not yet adding attributes > > > > > for the reset and cable_reset. I still don't understand what is the > > > > > case where the userspace would need to be able to tricker reset? Why > > > > > isn't it enough for the userspace to be able to enter/exit modes? > > > > > Oliver! Can you please comment? > > > > > > > > 1. Because we need error handling. > > > > Devices crash. Cables will crash. We will get out of sync. > > > > You never put yourself in a place where you cannot handle an > > > > IO error. > > > > 2. Because it is in the spec. We do not second guess the spec. > > > > We implement it. > > > > > > Error conditions and crashes are the responsibility of the USB PD > > > stack, not userspace. In those cases the stack can not wait for a > > > > Those are not exclusive conditions. > > > > > command from the userspace. So for example if a timer like > > > NoResponseTimer times out, the stack an its state machines will have > > > to take care of the reset quite independently. > > > > Yes. But somebody needs to handle high level errors. > > > > > If you get out of sync with an alternate mode, you reset that specific > > > alternate mode by exiting and re-entering it, and you do not reset the > > > entire PD connection, port, partner or cable. > > > > That would be the first step. If that doesn't work you will at that > > point either give up or use the next largest hammer. > > In principle you could do that in kernel space, but that implies > > that the kernel can detect all failures. That is unlikely. > > Any PD communication failures the kernel has to be able to detect, so > I guess you mean failures with the alternate modes themselves, right? > > In that case, surely exiting the mode is enough to "reset" it? When it > is re-entered, it has to be completely re-configured in any case. I > don't see how resetting the whole port or cable would guarantee that a > mode would become any more functional in case of failures? It will > however make also the other active modes to de-activate even if they > are functioning fine. Forget about it, I'll just add the reset attributes. I'm still not clear about their usefulness, but instead they will just create a small risk, but I can live with that. Cheers, -- heikki