Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3556232pxb; Tue, 19 Apr 2022 05:25:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwAy6xuib98PRkSkIXscOdiCp6vkdlbJe51r+zM56tzoF0f+tPcuNUE1e6DwreHh9yc+Xq X-Received: by 2002:a17:906:4d1a:b0:6e8:8860:8a72 with SMTP id r26-20020a1709064d1a00b006e888608a72mr13809849eju.540.1650371115109; Tue, 19 Apr 2022 05:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650371115; cv=none; d=google.com; s=arc-20160816; b=zxP9j8futDdrlUpOGnHVzIAsX6VbkPW/0lJr6NO0w+L5b9mML59ai7LoFkjdt0wfgG gJnetdMrgl8w+REZKAOJZooGxQrPf1KkbBKBAZM6NwhEmu3J7WB2W6Y4itY4PZgznCu+ q4H92DHX67wdjKtKrSUgD6M0IiXyqONA0YlkF3VhECSUJ5/A85HCdH1CfbVdnfAhBxN9 sVsmSlzqxl5yoYGkaRZ5QSDsrqZ98TTrW4ko///OSAnpx3UcoVLlm4KVXuHpR/mQPUss ccRPu7eHL53FAbb6QtUsJcCENkmDsi5zsc/TCWguBPYfCGQxE0NtEFVY2UJdTfFrLZ1v WqVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NQ9fZU5SuolMCEM57i3lQ/j8oNt4s6vKxMTZOypk3bc=; b=Aw3Mis/Ry3t8TNpN5TOijsXJg7QzxeqapWYXQOFM5h770gZOkkyMRTXOfRyP9+/NSJ StUd7n5hmB8j/AL5QYyrx2Q6ontwWVlrX90iEeT3fLtOXF9UUKkaaOpy4G/M/pPlbpUI CggE97AGrVCXGhUR5sq2qPmBbvONklMQDmoMZpWox5DFq0y+vzMRXIk6KkrO7cfUuHxD 9di4sA1YLH9BmYgVty+4RCPxcy/ofsxt505O5aND8xZ0a3XVBnhC9ze7O/5tGVzqV/QI c4WMMEio8FRjq3ZFFc8R40c4aw9ctOMTEZi3SzeW9LNzLUv1ovvMPY6B8QQ1HxNt+M1l N/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oEtC8PbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a50cd04000000b0041cef8a4f33si8993162edi.630.2022.04.19.05.24.51; Tue, 19 Apr 2022 05:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oEtC8PbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244323AbiDSA5J (ORCPT + 99 others); Mon, 18 Apr 2022 20:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244437AbiDSA5F (ORCPT ); Mon, 18 Apr 2022 20:57:05 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2452F27FED; Mon, 18 Apr 2022 17:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650329664; x=1681865664; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=bIElZ/ONSNAGuUnukdJ+HAUfMCgaREX0brCFR/k/fuk=; b=oEtC8PbWQUGBvsb8WcIqPHk45JNrgOEGOeXhbWe649hKijpkSpukyKY/ WobKjJZISjGVNdX4OXpXZlCyEBcnoMZnxXwPA6YdZnMQ46+XXTF/8YALS PonZv2A2B4iuOz0K0vGp72XNszGZggfUFJ9U6fuS+EkEfr8U5BZ2la1Ed mUakX9DiIetY7QWGzL0tmVK9Dni7Ugnlt1E8IQ7XSXsNZFq2LzYVKQQ6W HkjqjN2WaguLm3wACp07pWSa/z2tZHjH/HVmX+BURRD+cRlEWPtiODcZA C2+a+GvVmm21gFWOf5HEnCCcv2p47s4qwsweRkHlmaVCBRtxifJRRW9v8 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10321"; a="324085422" X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="324085422" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2022 17:54:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,271,1643702400"; d="scan'208";a="554472469" Received: from linux.intel.com ([10.54.29.200]) by orsmga007.jf.intel.com with ESMTP; 18 Apr 2022 17:54:23 -0700 Received: from linux.intel.com (ssid-ilbpg3-teeminta.png.intel.com [10.88.227.74]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 66F865808AE; Mon, 18 Apr 2022 17:54:19 -0700 (PDT) Date: Tue, 19 Apr 2022 08:52:20 +0800 From: Tan Tee Min To: Jakub Kicinski 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 , Alexandre Torgue Subject: Re: [PATCH net 1/1] net: stmmac: add fsleep() in HW Rx timestamp checking loop Message-ID: <20220419005220.GA17634@linux.intel.com> References: <20220413040115.2351987-1-tee.min.tan@intel.com> <20220413125915.GA667752@hoboy.vegasvil.org> <20220414072934.GA10025@linux.intel.com> <20220414104259.0b928249@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220414104259.0b928249@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 14, 2022 at 10:42:59AM +0200, Jakub Kicinski wrote: > 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? Thanks for the suggestion! I tried cpu_relax(), unfortunately the issue still happens when the system is in a high-load situation. I agree that the fsleep(1) (=1us) is a big hammer. Thus in order to improve this, I’ve figured out a smaller delay time that is enough for the context descriptor to be ready which is ndelay(500) (=500ns). Would you think this is more acceptable?