Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp332195imm; Mon, 21 May 2018 06:49:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoU2siVot20bCtu6D7ucxL5FG03S7zAzVaDMBZdg7s52LIHBC4sXpz1onGCls/AYDrxudxz X-Received: by 2002:a17:902:4303:: with SMTP id i3-v6mr21092538pld.394.1526910553218; Mon, 21 May 2018 06:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526910553; cv=none; d=google.com; s=arc-20160816; b=BjNGlKivDsfPOzdVpRs2S/i8tMmsOuPbcgXeyxBgR8r2LreX8kiqmkp+dJI+cWmcT3 vdQGTnn3Ilxfd+sVARB8luB5WCyJ2vyPFO/qpasCAZBTVxJfy5CPcpK7NSBmg48p8A4V //y6pjhwIKCR927RivGmswrPFF80Sz4XmU6ujY6uk9zEIIe1EU1iMs35k7wUicmAMnQX beHJ41nOJB5tkPBydzbAhdZqX0y9IVe8eQPRiEN76UZDSASp6f90BwQJVYqAmeAdazoI lEGbf2JfXtYhLIOFNoYFi/HYFx7OiTtMAQCeGRMLm8opTRWRu564FkaXPIrj4BdHXSvm XuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=TQDO7CLkO4XEp8GIp/eRLx9v8MxnTp02nXezGg+ZmuM=; b=bfCmFWe00t50hGxf/iIUcRsYFN0i3l4P+RwweXsIS5eQSwjcxHwzmQYex11A7ogTRG hnxrd9d3rTYyhGCmkw7q+ttAAWTqU5kBmVx0idyUFmrssIIj9FeALGjVYTYdZ8nsUh54 q4U0cQaEC1rXik8NrSKwpUiJhf9nuvPWsNFJdyaZxmOl86mLUMc40orXHhTdU+gL2y85 atmo7Wqo0PFza6AJXLBarCEzDSYEo9lsjXPvJTsxpf9qR7AG3d1aYoU4LTjNq9pPsFv3 QHxIBXb/Z6Wm4PLxaj0aVKrstZeTc1MyavPdaV6iSHa8R8Uit4J9amBD8pXQC6S23tUS B5BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n3BKVU5W; 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=fail (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 94-v6si11763903pla.500.2018.05.21.06.48.58; Mon, 21 May 2018 06:49:13 -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=fail header.i=@gmail.com header.s=20161025 header.b=n3BKVU5W; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbeEUNsn (ORCPT + 99 others); Mon, 21 May 2018 09:48:43 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:45023 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbeEUNsi (ORCPT ); Mon, 21 May 2018 09:48:38 -0400 Received: by mail-lf0-f67.google.com with SMTP id h197-v6so23996900lfg.11; Mon, 21 May 2018 06:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TQDO7CLkO4XEp8GIp/eRLx9v8MxnTp02nXezGg+ZmuM=; b=n3BKVU5WsLqDGlFCnrc0OALXX/QFNMWjUu2QtWDSUMy/6fTevqGJ+uJueqvNQ78FtD 0fkZQXlIQItQyzcVtTVy63gsGMiRL5+Xcj3LrOAOxSwTiAwtVgzirxxg1z161K3CqKRl aLsTluO6CRIzp6SYYdQcYyGR0BOpwvJgGXevidkX7jB7gxM3ZBO8XFPBv8RsgtZLeSP2 4I1y94bA7uVkDJDzoVoTZdRQ3V2RF0bScbbjl06DmWHcfTEC2AoKYM4WjGa+s+3b7s05 kpJQcmgstY904CmVzMZ0tYdWX77h1ptl1NytmC2zFmBJTMCWBqpZV28VS3kdVrYbaMXc p1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=TQDO7CLkO4XEp8GIp/eRLx9v8MxnTp02nXezGg+ZmuM=; b=nMDvjgu/qP58lBZX0dmrSPhX3zqUuQ60BY0zfpAdtUKRtspTNzC4nx0q/Y+daWFIOt /V/FYW2W0S1DD9SRalD2LY1iauvvxtEz4Yqlm7RJWy9CCd6MxKUs7v2oMzS401dmr85p ov6QUz+ZS4Wm7u/vRyjWogIFnbpsGzcqt0WVrCKnNNTA00q1VDHRUDNCOJnaIgJqqkKg WC4MCfUlFbURmokbR9noUibQZ1YybCg1VCKGKV/ZX821bnBWp+JpbD0zaF9LPso8y2DA l0wlI9c3RV1LHtPCCo0ga4t0QwW9Z7kvdfivuh4MBUwRKrI6WjGFqdV5ATqPmx+xTkqs cQUA== X-Gm-Message-State: ALKqPwdCgJfstvrAnFfuq5ijC5e1rNx93Ri5LoSO1G51xCKsdEA2T3Jp X/xbjNnHF5K2sRX2u3J/jbq1iFZm X-Received: by 2002:a2e:330c:: with SMTP id d12-v6mr12752640ljc.8.1526910516371; Mon, 21 May 2018 06:48:36 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id r78-v6sm2465542ljb.20.2018.05.21.06.48.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 06:48:35 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fKlAs-0007l7-9L; Mon, 21 May 2018 15:48:30 +0200 Date: Mon, 21 May 2018 15:48:30 +0200 From: Johan Hovold To: Tony Lindgren Cc: Johan Hovold , Sebastian Reichel , "H. Nikolaus Schaller" , Andreas Kemnade , Mark Rutland , Arnd Bergmann , Pavel Machek , "linux-kernel@vger.kernel.org" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Greg Kroah-Hartman , Rob Herring , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: OMAP serial runtime PM and autosuspend (was: Re: [PATCH 4/7] dt-bindings: gnss: add u-blox binding)) Message-ID: <20180521134830.GR30172@localhost> References: <20180507175032.GR98604@atomide.com> <20180508065852.GW2285@localhost> <20180508152228.GV98604@atomide.com> <20180508154756.GW98604@atomide.com> <20180508155405.GX98604@atomide.com> <20180508164904.GZ98604@atomide.com> <20180509131003.GC2285@localhost> <20180509135706.GB98604@atomide.com> <20180517100948.GI30172@localhost> <20180517171038.GL98604@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180517171038.GL98604@atomide.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 10:10:38AM -0700, Tony Lindgren wrote: > * Johan Hovold [180517 10:12]: > > [ Sorry about the late reply. ] > > > > On Wed, May 09, 2018 at 06:57:06AM -0700, Tony Lindgren wrote: > > > * Johan Hovold [180509 13:12]: > > > > > > It seems we really should not be using the negative autosuspend to > > > > configure the RPM behaviour the way these drivers do. Perhaps a new > > > > mechanism is needed. > > > > > > Hmm well simply defaulting to "on" instead of "auto" and setting the > > > autosuspend_ms to 3000 by default might be doable. I think that way > > > we can keep use_autosuspend() in probe. Let's hope there are no > > > existing use cases that would break with that. > > > > No, defaulting to "on" (i.e. calling pm_runtime_forbid()) wouldn't work > > either as that would also prevent the device from runtime suspending > > just as the current negative autosuspend delay does. > > Well in that case we should just stick with -1 value for the > autosuspend. And just do pm_runtime_put_sync_suspend() after > probe and on close. That won't work either as a negative autosuspend delay prevents runtime suspend completely (by grabbing an extra RPM reference). > > I fail to see how we can implement this using the current toolbox. What > > you're after here is really a mechanism for selecting between two > > different runtime PM schemes at runtime: > > > > 1. normal serial RPM, where the controller is active while the > > port is open (this should be the safe default) > > Agreed. And that is the case already. Yes, but it's not really the case today as since omap-serial (and 8250-omap) sets a negative autosuspend at probe and hence does not runtime-suspend when the port is closed. So that's the long-standing bug which needs fixing. > > 2. aggressive serial RPM, where the controller is allowed to > > suspend while the port is open even though this may result in > > lost characters when waking up on incoming data > > In this case it seems that the only thing needed is to just > configure the autosuspend delay for the parent port. The use of > -1 has been around since the start of runtime PM AFAIK, so maybe > we should just document it. I guess we could also introduce > pm_runtime_block_autoidle_unless_configured() :) The implications of a negative autosuspend delay are already documented (in Documentation/power/runtime_pm.txt); it's just the omap drivers that gets it wrong when trying to do things which aren't currently supported (and never have been). So I still think we need a new mechanism for this. > > For normal ttys, we need a user-space interface for selecting between > > the two, and for serdev we may want a way to select the RPM scheme from > > within the kernel. > > > > Note that with my serdev controller runtime PM patch, serdev core could > > always opt for aggressive PM (as by default serdev core holds an RPM > > reference for the controller while the port is open). > > So if your serdev controller was to set the parent autosuspend > delay on open() and set it back on close() this should work? Is it really the job of a serdev driver to set the autosuspend delay of a parent controller? Isn't this somethings which depends on the characteristics of the controller (possibly configurable by user space) such as the cost of runtime suspending and resuming? The patch I posted works with what we have today; if a parent serial controller driver uses aggressive runtime PM by default or after having been configured through sysfs to do so. What I'm getting at here is that the delay should be set by the serial driver implementing aggressive runtime PM. Then all we need is a mechanism to determine whether an extra RPM reference should be taken at tty open or not (configurable by user space, defaulting to yes). Specifically, the serial drivers themselves would always use autosuspend and not have to deal with supporting the two RPM schemes (normal vs aggressive runtime PM). Thanks, Johan