Received: by 10.192.165.156 with SMTP id m28csp1379673imm; Wed, 11 Apr 2018 18:34:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/gDaKza4zSKYfQpSeKr8A+6Q2SxRiXi/iXqXqh/GB3nSf2rYqf6Dpuk9PgkojteZ/4adpZ X-Received: by 2002:a17:902:82cb:: with SMTP id u11-v6mr7303818plz.401.1523496855531; Wed, 11 Apr 2018 18:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523496855; cv=none; d=google.com; s=arc-20160816; b=WqGhujXdG7bKd16afg3SX0HlCADwvxVSrO8UrPvbwh4mKns3YzX/bPKihk2eIgC3jh FSXV3RJ79MVJX08Feh6U8PfQj/yntxWpk+R+FHAlKwoao7uS/8vuAyDqdT3zFUqEfTAC nYqu7ukvdUYwIaWMewfdr4sPxLZgoF/D4H9KfR+BTtWj39l2oJOLR0rL13f5gdHnUery 1JCLiBHIdwTqhRmhaj7L1uiBGueb89sUXfvW6thTnZbBpe97D3/KnRt1/uOk289D7iNG o+VMvlSTo5Uvp4gSC4oXYTXasFN4a5Jv4EAoRJqzkK3rHprkGa+DbmPAuBmombANmoly bQzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=n88iqFR8BBd8Ci4haWdle3HRhxwLTCnlrnKlQdabRv4=; b=YSirbA2nQMy0gp1O1ATVQlv0ydmVhU799q2gnx4aqc7SdBroV4uwMJOnQ82nhonVmY Glwp3FLgivE/zaG8JtqQUt/A7MRu0AY8BMQlh2o2TxXUEPuzLK27l4zJiv7MFstMus7a rHmCAB+3mYeBZPhol480uNno1dj4i8kQFeScJOL83cfzEfOTC1oLddZyIYcDod6t1b9U qMpPQbmztD+rjbecFB+90loNamp1bOLhm2HxKwtD1jjuqYkj34e5hKY8F6HeAQRZoc8j CLFfeOC2p+PktamZL/oQJioChqSgvn13L3vfSHIxDGepCHBkcaLKRFz2L/DagsSz+Qf1 o4MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dqy2zv4a; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si1808514pfj.215.2018.04.11.18.33.38; Wed, 11 Apr 2018 18:34:15 -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=pass header.i=@gmail.com header.s=20161025 header.b=Dqy2zv4a; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752363AbeDLBaz (ORCPT + 99 others); Wed, 11 Apr 2018 21:30:55 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:37662 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbeDLBax (ORCPT ); Wed, 11 Apr 2018 21:30:53 -0400 Received: by mail-pf0-f193.google.com with SMTP id p6so2212028pfn.4; Wed, 11 Apr 2018 18:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=n88iqFR8BBd8Ci4haWdle3HRhxwLTCnlrnKlQdabRv4=; b=Dqy2zv4aaZurWMa8swhDgoQI0KIf8Fxat/1soPPw7gCfmcVxwkWPncVCBlMfOH2siM d8Jb/zTqdbAVTsU/vOY6edymCZLtqHw2MRKv+WwVVCKCuZn62UrzF2OdDZLeBuTcBug8 GZ7NXmq0xq9NAFKgpD3yYIbUDRFzFlnX99+e2gIaoN1D06coiPesTfx20sMKvUJtYvxk NSn5rWQFQbRx1uBPvRJ7J1qN/Xs+xBx24LHtjNuVPTYWnATjfpYVsBjlxXCbKvQUG9b3 vgcH1vBzyNb7q+XaXd7XlVxZgfmIqBzGlkkHvUv8SfeSijn2N5lJeFium3Odj3l7HKZu uHHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=n88iqFR8BBd8Ci4haWdle3HRhxwLTCnlrnKlQdabRv4=; b=XllnofeuflK3BFQGv/Vdbr1XqRKH2HWEPa+AhxG2llzWgzcb4X4Mlk6G0+WcsV+RXc nstntvxqv+EMXcFG7n6rPsuPbjUy5mYV8bxJ92CYCxWHrqrdkILSrX2N3Xdi9cQFYIT5 XQ5/Ep6+ZYQxpmQtTf5XSe1+B2xtnESH2o4gpry1b4FS7q5y7d3JYkisrssCXVib+THL z6Bh31WiGwMaEDx/H0xvZRBYVBfe0BF1zBd+1jAjPuhR5OkAtKAdHpC4vE6ESa38tD57 DsOwoQrPu003rTvqSnxIg3nRN+lgZ2FlA1SyWO7BSIwFAHvGEktFhkHQAVwCAghwVH48 CfkQ== X-Gm-Message-State: ALQs6tBOZPvkKcUXb+K2fQYgYiJ9SqzioGMdZeleDaj0Mk/HK02HSTcC vY1ZYva3dHKIKcYCqCFJXA4mjHfkWe8= X-Received: by 10.99.170.70 with SMTP id x6mr5142763pgo.114.1523496652451; Wed, 11 Apr 2018 18:30:52 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.53? ([2402:f000:1:1501:200:5efe:a66f:4635]) by smtp.gmail.com with ESMTPSA id f19sm3670062pgv.39.2018.04.11.18.30.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 18:30:51 -0700 (PDT) Subject: Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init To: James Bottomley , davem@davemloft.net, stephen@networkplumber.org, johannes.berg@intel.com, arvind.yadav.cs@gmail.com, dhowells@redhat.com Cc: netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org References: <1523461182-5897-1-git-send-email-baijiaju1990@gmail.com> <1523463379.3221.18.camel@HansenPartnership.com> From: Jia-Ju Bai Message-ID: <8bac3385-97c6-fff1-17c6-11f5e98a039a@gmail.com> Date: Thu, 12 Apr 2018 09:30:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1523463379.3221.18.camel@HansenPartnership.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/4/12 0:16, James Bottomley wrote: > On Wed, 2018-04-11 at 23:39 +0800, Jia-Ju Bai wrote: >> de4x5_hw_init() is never called in atomic context. >> >> de4x5_hw_init() is only called by de4x5_pci_probe(), which is only >> set as ".probe" in struct pci_driver. >> >> Despite never getting called from atomic context, de4x5_hw_init() >> calls mdelay() to busily wait. This is not necessary and can be >> replaced with usleep_range() to avoid busy waiting. >> >> This is found by a static analysis tool named DCNS written by myself. >> And I also manually check it. > Did you actually test this? The usual reason for wanting m/udelay is > that the timing must be exact. The driver is filled with mdelay()s for > this reason. The one you've picked on is in the init path so it won't > affect the runtime in any way. I also don't think we have the hrtimer > machinery for usleep_range() to work properly on parisc, so I don't > think the replacement works. > > James > Hello, James. Thanks for your reply :) I agree that usleep_range() here will not much affect the real execution of this driver. But I think usleep_range() can more opportunity for other threads to use the CPU core to schedule during waiting. That is why I detect mdelay() that can be replaced with msleep() or usleep_range(). Best wishes, Jia-Ju Bai