Received: by 10.223.176.46 with SMTP id f43csp824386wra; Fri, 26 Jan 2018 07:29:38 -0800 (PST) X-Google-Smtp-Source: AH8x2266fvI3ZQxJTygFZ5TAsJ7LZz0XoJLO+oyzQc+xdycp+39fm/Mwwne7JY0dAyVdsjGnxrnn X-Received: by 10.98.67.138 with SMTP id l10mr19233090pfi.72.1516980578234; Fri, 26 Jan 2018 07:29:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516980578; cv=none; d=google.com; s=arc-20160816; b=Ze0SNoXa1TTzQHOyuU2tbTdnAqSNwHfidgoUwZTtd2mMOtVfU9pazb/755CzpgBzO1 1OKlQp3i+RbWOQOgp4/R6jAy9V2XCc7dM7b9sN7puSM/g/Q3g7xA920bCvynVL2aVvuj qgWvN5OphjNuvlihnL1G/+uTa5KPSEl7JpElkdz76asLF4MPDzeAuykQbm+RhmATo+Pa q3IGwk7m+J8F5VXN0Xa9KFMUELdko+P7cql4Dh0DdJi8x3Q6E32DdA8NnAyG5yjmQH8e dEPZigiPiM22afnUUZ+yj7OJhV9WezahzdVB7ghhJWrOJ7yZ1YmLC5PF7IvsbqGpQaW1 vcig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=xzJtynHDf53FfDeEmx9WTv9onx4w2ozO0LaPmclDOtE=; b=DLql0q83CDGg6OfEoXVRL76Q0NgmZ9eu9kpt65WJhd8K6cuj7UVpknVKjXB7sS1nLR 3c5ph3ITwFdf1glnonesFdduTE2IdWrUZy3AQvoQgdL94rxDaJC4kR+Ay2nnQ9WHJ+ht 86vqfjQCyWQ6124MWeIexls8N7GjAjibVD2x+93eJ4GNrvD+qymi/OwMFDIG5XFF+nfL Nob0EUUtrRoKavipNZAXjLRLq82hilBZxeGcjbzvpXE0beviTkBsQ7DS0WhI4Dk+C1D1 bWeHvFfwY7kPWYjWfF/lTVCNd5dn8So74hoxfdvLd8pLOyo+rA6rWLjsX+g9k87PUEAt jfSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CroE7PGO; 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=NONE 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 k29si6471723pfj.228.2018.01.26.07.29.24; Fri, 26 Jan 2018 07:29:38 -0800 (PST) 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=CroE7PGO; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753720AbeAZP2R (ORCPT + 99 others); Fri, 26 Jan 2018 10:28:17 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:43872 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753652AbeAZP1w (ORCPT ); Fri, 26 Jan 2018 10:27:52 -0500 Received: by mail-pg0-f65.google.com with SMTP id n17so454850pgf.10 for ; Fri, 26 Jan 2018 07:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=xzJtynHDf53FfDeEmx9WTv9onx4w2ozO0LaPmclDOtE=; b=CroE7PGO4kE6OA2i7pwNIVYoW+hMvvuR4xdiWhBDJRASFI4SPnvESCvsF5Pc1nsRr7 NQehZuha7pGtFUylnbAXQIwAKcLVS19WaoaYizI3pllSQypfS4KX9piZk8JQU1dqPQJ2 CYHHhBqgrDHoxPw8ZdFmZ3at5XQHucnYHW4aSfeEQkeQZwTrhnrttyDlzuoy+OOTZiBL rnEaKT5E+TqCFxHGSh2Dtn5t+UOk4pMeIoVr3OMuPzj62tCaCS7A1cRTvIBQOOcVe4RR 8GIMeqFPL/Fc3hooyqA5jZoXZjrH6VFEYg60T2qjtQfF6vOpN27F2LOF79c3u1kBKKh7 OvgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xzJtynHDf53FfDeEmx9WTv9onx4w2ozO0LaPmclDOtE=; b=OEwTfpsrSM5KO5XMkJG2AdZY+q/1lz8oDi3enongSV7t04kflAcu8cbOmRg4EgFbGF aeUHg58nAX8vQkK19dlymiUnHu8UFIvOX/sFpLdbHsAIw+pWgSFHWFOfKkkCvRp3gmTh VavNpUIf9J3/lGuD5gLEe2cUxrf+RduifPQrnrbjfwD+Mdnkalhj4bEgT1sYHG64pxFD NXUyUDFcIhsJRmpl+/xIUbzR818jlS7FzxGpm7pGdWvs3EVrIZ2FjsyqolzEUHcoUjcl IUkI8ll9ZEaAqh+9LzuMN4XivosJY4wxMGkOK+mXLx8OSUvf49BEbfmgwFiQQcc/zZ3Z Po/Q== X-Gm-Message-State: AKwxyteX7OVMjNoW+YYFK4m/M8tuUGDlViPMjuC732GWAuOl6dQmuoSW bK2fGOW0zxun+26aOvoE+3c= X-Received: by 10.101.96.6 with SMTP id m6mr7075719pgu.131.1516980472455; Fri, 26 Jan 2018 07:27:52 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id 184sm18990978pfd.156.2018.01.26.07.27.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:27:52 -0800 (PST) From: Jia-Ju Bai To: axboe@kernel.dk, ming.lei@redhat.com, Bart.VanAssche@sandisk.com, jthumshirn@suse.de, hare@suse.com, sagi@grimberg.me Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 3/3] block: mtip32xx: Replace mdelay with msleep in mtip_handle_tfe Date: Fri, 26 Jan 2018 23:32:27 +0800 Message-Id: <1516980747-7977-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to mtip_handle_tfe() here, my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And mtip_handle_tfe() is only called by mtip_service_thread() that can sleep as described in the last patch, so it indicates that mtip_handle_tfe() can call functions that can sleep. Thus mdelay can be replaced with msleep to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index b8af735..b302167 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -604,7 +604,7 @@ static void mtip_handle_tfe(struct driver_data *dd) print_tags(dd, "completed (TFE)", tagaccum, cmd_cnt); /* Restart the port */ - mdelay(20); + msleep(20); mtip_restart_port(port); /* Trying to determine the cause of the error */ -- 1.7.9.5