Received: by 10.192.165.148 with SMTP id m20csp1015938imm; Sat, 5 May 2018 03:04:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZofq0MRvu5xbdA9Agdd1LoHmD26c51lytXnU0cAZ5SGKibQAThjt6pARM0r8cRM/xkewBI+ X-Received: by 2002:a17:902:5a0d:: with SMTP id q13-v6mr30822674pli.199.1525514650175; Sat, 05 May 2018 03:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525514650; cv=none; d=google.com; s=arc-20160816; b=ZarV48+u0KaK7tggGJOTSS7i6YyXLoCicK04QGuoTjg87JUlUzN5TpPTEunfXqLxBv gzxNmoM9vgLaBazjHPcNCWKaA7zAJLk6J6l6RIK97/vVeaBFhnz3Majol1JH188ME7yY RGmEul4yKXs4VJxH+VKDCzStAK8WstZ4Qrwp8SO0YL8isB8KJBFiq9PotennzEFBo0Px jdOt2vWS0gDpwjm8bY1bTAjBhabNIFoDY5UqyV/hOZTaDMUIgr5Am6btQsASo1DlqceD SPSPjbX6FALk9ostbMcl/cCzRUaxu9sCZ+jSJjx21NImCKdZ8FFWchiXjw+46HoDduQM db8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=IBnjU2P8B8wH4a/nXWt6IH2zfZoFdNrsNyuanRV/t4Q=; b=Gk0tBqcAuz3eYd2gRDjK6oEMObUquDa8BcS7cUadoT2WT5LB5Z1cu+UwERh9doYOQa 8Ah4ScpPB3KAmFhhQpmy/KJ/Bb6BiaiefFVGyq/AFrk0FwIlfUtSqlsPs4GYCyqYC4gA ev8eOeoU9WJiUu/88bu7KRJ2TaTgO813iHe9YVBYisZY2okTvCVfEp21Azs9TYJdWlXA PvZhha1SdsZXOT/BU7q1tWpnLjGAf2glH/bekq8YqI35u5YoSZ6TOAKTWVC97GB7gyTC EzZkpXqkqggcTCFWB4nBAR9XDBCdubjFM6S+sH7NAt0z5Wmqnn3VRhvFF8YhTi6ruJRU otcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=jgVDpfhT; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si17796255pfs.91.2018.05.05.03.03.55; Sat, 05 May 2018 03:04:10 -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=@ti.com header.s=ti-com-17Q1 header.b=jgVDpfhT; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819AbeEEKDd (ORCPT + 99 others); Sat, 5 May 2018 06:03:33 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:41791 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbeEEKDb (ORCPT ); Sat, 5 May 2018 06:03:31 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w45A3FGt021868; Sat, 5 May 2018 05:03:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1525514595; bh=IBnjU2P8B8wH4a/nXWt6IH2zfZoFdNrsNyuanRV/t4Q=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=jgVDpfhTWnSB1hfonfIGs2phMDWe99FTrmfvyZC0H9r6AtIVVw0h+YhCZSSMpcnrq 2wh79YviiZ0aSm0sqNewKQeTQeK1azaAGlgv8U365qLn8tQ0SXyHstoSaogKiAVzEZ 5ihryOAbfNDMXJ60YdgpCEKc/pI7LD3GnwZpnorg= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w45A3F87010497; Sat, 5 May 2018 05:03:15 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Sat, 5 May 2018 05:03:15 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Sat, 5 May 2018 05:03:15 -0500 Received: from [172.24.190.233] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w45A3Cpm009858; Sat, 5 May 2018 05:03:13 -0500 Subject: Re: [PATCH] pci: endpoint: Replace mdelay with usleep_range in pci_epf_test_write To: Lorenzo Pieralisi , Jia-Ju Bai References: <1523365446-31563-1-git-send-email-baijiaju1990@gmail.com> <20180504162932.GA16953@e107981-ln.cambridge.arm.com> CC: , , , , , From: Kishon Vijay Abraham I Message-ID: Date: Sat, 5 May 2018 15:33:11 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20180504162932.GA16953@e107981-ln.cambridge.arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 04 May 2018 09:59 PM, Lorenzo Pieralisi wrote: > On Tue, Apr 10, 2018 at 09:04:06PM +0800, Jia-Ju Bai wrote: >> pci_epf_test_write() is never called in atomic context. >> >> The call chain ending up at pci_epf_test_write() is: >> [1] pci_epf_test_write() <- pci_epf_test_cmd_handler() >> >> pci_epf_test_cmd_handler() is set as a parameter of INIT_DELAYED_WORK() >> in pci_epf_test_probe(). >> This function is not called in atomic context. >> >> Despite never getting called from atomic context, pci_epf_test_write() >> 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. >> >> Signed-off-by: Jia-Ju Bai >> --- >> drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > I'd request Kishon's ACK on this. sorry, missed this before. Acked-by: Kishon Vijay Abraham I > > Thanks, > Lorenzo > >> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c >> index f9308c2..2f0642e 100644 >> --- a/drivers/pci/endpoint/functions/pci-epf-test.c >> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c >> @@ -237,7 +237,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) >> * wait 1ms inorder for the write to complete. Without this delay L3 >> * error in observed in the host system. >> */ >> - mdelay(1); >> + usleep_range(1000, 2000); >> >> kfree(buf); >> >> -- >> 1.9.1 >>