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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6EB3E9270F for ; Thu, 5 Oct 2023 14:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234126AbjJEOdW (ORCPT ); Thu, 5 Oct 2023 10:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235180AbjJEObh (ORCPT ); Thu, 5 Oct 2023 10:31:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153C110CE; Thu, 5 Oct 2023 06:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696513714; x=1728049714; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/qcg9z9QjvBBFf2lrrpqt3uTlEPx56wjWhM7cNUhZdk=; b=DaVpxLG1ZwQB4MHj+/gzTu8CSLiAGjp1z7nfUXvDWVUsfBxC9+pPwnxq f2fuCpmdjz1WD0FRy27NWgiox21j32NZDBeAVXEWSamm+jtJT1uBu2u+K TXJR6Vej63HpBHDONxpncO2INswa4IznDOSwWeqZU2krjD0X1ff4u4lV+ CQ8pbtDRLhnbxFcp+JHh9tdd8UcmfZ66BW/2R0yGB4FUP/4HJFwhl12mX +a0GDs2kblAc8s06lMcu2OEXqrWXg8dL8WL21FwaFuKkSsZN99MyoO9Jf Vk/EV5dyAxKoA98FpEAS3cRtJUydqJqemDopwGrKx8yW+nXVHJpM1XB3c w==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="469745820" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="469745820" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 05:00:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="867860677" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="867860677" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 05:00:54 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC1) (envelope-from ) id 1qoN2B-000000030w6-1WjO; Thu, 05 Oct 2023 15:00:51 +0300 Date: Thu, 5 Oct 2023 15:00:51 +0300 From: Andy Shevchenko To: Tony Lindgren Cc: Greg Kroah-Hartman , Jiri Slaby , Dhruva Gole , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , John Ogness , Johan Hovold , Sebastian Andrzej Siewior , Vignesh Raghavendra , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Maximilian Luz Subject: Re: [PATCH] serial: core: Fix checks for tx runtime PM state Message-ID: References: <20231005075644.25936-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231005075644.25936-1-tony@atomide.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Thu, Oct 05, 2023 at 10:56:42AM +0300, Tony Lindgren wrote: > Maximilian reported that surface_serial_hub serdev tx does not work during > system suspend. During system suspend, runtime PM gets disabled in > __device_suspend_late(), and tx is unable to wake-up the serial core port > device that we use to check if tx is safe to start. Johan summarized the > regression noting that serdev tx no longer always works as earlier when the > serdev device is runtime PM active. > > The serdev device and the serial core controller devices are siblings of > the serial port hardware device. The runtime PM usage count from serdev I'm a bit lost in terminology here. AFAIU there are: 1) children of the serial physical device; 2) siblings (to each other). But may be I mistakenly deciphered the diagram from the previous discussion. > device does not propagate to the serial core device siblings, it only > propagates to the parent. > > In addition to the tx issue for suspend, testing for the serial core port > device can cause an unnecessary delay in enabling tx while waiting for the > serial core port device to wake-up. The serial core port device wake-up is > only needed to flush pending tx when the serial port hardware device was > in runtime PM suspended state. > > To fix the regression, we need to check the runtime PM state of the parent > serial port hardware device for tx instead of the serial core port device. > > As the serial port device drivers may or may not implement runtime PM, we > need to also add a check for pm_runtime_enabled(). Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko