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 19D7FC433EF for ; Thu, 14 Apr 2022 08:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241074AbiDNIpm (ORCPT ); Thu, 14 Apr 2022 04:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239558AbiDNIph (ORCPT ); Thu, 14 Apr 2022 04:45:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D712965796; Thu, 14 Apr 2022 01:43:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A5536208B; Thu, 14 Apr 2022 08:43:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3406C385A5; Thu, 14 Apr 2022 08:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649925791; bh=iHZqK4K6Vu+KtomeHU+dePQzrkU7Y2MgGUiDicf1Wms=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YfpsG3DHQxvqsl7laZpVeqMWas0uw1WWEfQ7MdGYXDkI0ZdQnz/wgk09mSVBb2cp+ uGskG3PDsJrK3Z8JEcgBj4VxDusYggKK5JoLf8MzikpDfm7rLDUcQv5qWLWuQXJAz7 AETSy1Xar9DIGuU+nARBCnLJkDXTKWFu+1dY/4Jp2bsY+luai/i7tHt4D547WhPFi/ WjbNX37dYJtr5eh7qViBy/zt2jXJziDaxiq0sawamgjY7vg4voXnK5E/LaV0lp9ET+ pWBh3d0F3tyBLP7Z3Pjo/93FqilmSqUNCoI7keU14fNphnYJMQ8LngUZOnQSyDnGSk 4qKTDEfb58k2Q== Date: Thu, 14 Apr 2022 10:42:59 +0200 From: Jakub Kicinski To: Tan Tee Min Cc: Richard Cochran , Tan Tee Min , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Paolo Abeni , Maxime Coquelin , Rayagond Kokatanur , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Voon Wei Feng , Wong Vee Khee , Song Yoong Siang Subject: Re: [PATCH net 1/1] net: stmmac: add fsleep() in HW Rx timestamp checking loop Message-ID: <20220414104259.0b928249@kernel.org> In-Reply-To: <20220414072934.GA10025@linux.intel.com> References: <20220413040115.2351987-1-tee.min.tan@intel.com> <20220413125915.GA667752@hoboy.vegasvil.org> <20220414072934.GA10025@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Apr 2022 15:29:34 +0800 Tan Tee Min wrote: > > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c > > > @@ -279,10 +279,11 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc, > > > /* Check if timestamp is OK from context descriptor */ > > > do { > > > ret = dwmac4_rx_check_timestamp(next_desc); > > > - if (ret < 0) > > > + if (ret <= 0) > > > goto exit; > > > i++; > > > > > > + fsleep(1); > > > > This is nutty. Why isn't this code using proper deferral mechanisms > > like work or kthread? > > Appreciate your comment. > The dwmac4_wrback_get_rx_timestamp_status() is called by stmmac_rx() > function which is scheduled by NAPI framework. > Do we still need to create deferred work inside NAPI work? > Would you mind to explain it more in detail? fsleep() is a big hammer, can you try cpu_relax() and bumping the max loop count a little? 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19AD2C433F5 for ; Thu, 14 Apr 2022 08:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ebEM/QK/hBLAhn6tMS7LVEy+NRFHX/Q2nTBZ0JtDQzQ=; b=13ALFP4xiGEa51 lXekd95OsbeT2e/EEfP8nHL4HbZermrbR7objRFA+7JVHN7r8KU6VuVhWCxilK76Xwi2h5I1Hco3C A4D5P/jC9azp89IoLLTQDR68taadU+siFIj/r3OAY03AU5NPKw2Bogt3R3XMXCNoaoTq+olONj/Ax QC9zQdAHk69b4Rb+uv4sD/1svyPrbNTZv5CueULQFDD3PCEduU6sP9ObnWoCizVwBP5PJNgKUo/NW L7qC1OlZ6WthvWLwg/5q2gd4K5fE9Cjy+IUgXYBmcj2671caxyaLFsbuqKRLmF8O+joDXa9VunHcs h4S48Y6PL0PIwZ0Zmmrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nev4O-004c00-Cr; Thu, 14 Apr 2022 08:43:16 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nev4L-004bz9-L4 for linux-arm-kernel@lists.infradead.org; Thu, 14 Apr 2022 08:43:15 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A3AE6206E; Thu, 14 Apr 2022 08:43:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3406C385A5; Thu, 14 Apr 2022 08:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649925791; bh=iHZqK4K6Vu+KtomeHU+dePQzrkU7Y2MgGUiDicf1Wms=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YfpsG3DHQxvqsl7laZpVeqMWas0uw1WWEfQ7MdGYXDkI0ZdQnz/wgk09mSVBb2cp+ uGskG3PDsJrK3Z8JEcgBj4VxDusYggKK5JoLf8MzikpDfm7rLDUcQv5qWLWuQXJAz7 AETSy1Xar9DIGuU+nARBCnLJkDXTKWFu+1dY/4Jp2bsY+luai/i7tHt4D547WhPFi/ WjbNX37dYJtr5eh7qViBy/zt2jXJziDaxiq0sawamgjY7vg4voXnK5E/LaV0lp9ET+ pWBh3d0F3tyBLP7Z3Pjo/93FqilmSqUNCoI7keU14fNphnYJMQ8LngUZOnQSyDnGSk 4qKTDEfb58k2Q== Date: Thu, 14 Apr 2022 10:42:59 +0200 From: Jakub Kicinski To: Tan Tee Min Cc: Richard Cochran , Tan Tee Min , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Paolo Abeni , Maxime Coquelin , Rayagond Kokatanur , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Voon Wei Feng , Wong Vee Khee , Song Yoong Siang Subject: Re: [PATCH net 1/1] net: stmmac: add fsleep() in HW Rx timestamp checking loop Message-ID: <20220414104259.0b928249@kernel.org> In-Reply-To: <20220414072934.GA10025@linux.intel.com> References: <20220413040115.2351987-1-tee.min.tan@intel.com> <20220413125915.GA667752@hoboy.vegasvil.org> <20220414072934.GA10025@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220414_014313_776076_A59AB722 X-CRM114-Status: GOOD ( 15.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 14 Apr 2022 15:29:34 +0800 Tan Tee Min wrote: > > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c > > > @@ -279,10 +279,11 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc, > > > /* Check if timestamp is OK from context descriptor */ > > > do { > > > ret = dwmac4_rx_check_timestamp(next_desc); > > > - if (ret < 0) > > > + if (ret <= 0) > > > goto exit; > > > i++; > > > > > > + fsleep(1); > > > > This is nutty. Why isn't this code using proper deferral mechanisms > > like work or kthread? > > Appreciate your comment. > The dwmac4_wrback_get_rx_timestamp_status() is called by stmmac_rx() > function which is scheduled by NAPI framework. > Do we still need to create deferred work inside NAPI work? > Would you mind to explain it more in detail? fsleep() is a big hammer, can you try cpu_relax() and bumping the max loop count a little? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel