Received: by 10.223.176.46 with SMTP id f43csp825406wra; Fri, 26 Jan 2018 07:30:24 -0800 (PST) X-Google-Smtp-Source: AH8x224CSg1mfFPkE0aNmiqg3XEdtQB4M2ekY8IdzBBha8kQVTXljeZ+LYqq1bDmlb052ubjKZ+K X-Received: by 10.99.159.2 with SMTP id g2mr11219714pge.156.1516980624282; Fri, 26 Jan 2018 07:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516980624; cv=none; d=google.com; s=arc-20160816; b=JXw6xMu+gj2IRXm51x3h6F+1n+YSxJU5xfNB4Ys5AjeacngSe9JBQq/M/VpgAAqH05 Stn5skciR37uXEyfZEB4Qz3XcxHvJpcNE0uLgnv3MSPfsDTSZKwduuKL6WdIQv1zfb00 p3OJOTapJZ4Ls7S4eInGJWu+UaUN319Aazgn+1wyt2yx1cByaImckDKYHiS5g2O+BmFW dVWfGMeoUsoUwC0mqTVrp8Z5B0cg2g+SwhQl2R3USmVJCP0QSEr19kxI269yilg3X7m1 PumMAxgT4gBkTLG3lz5czLFOaV/fQcPI6XnS3fOspeBKFBHUqAqa4Qa3/YEAK7KbJ8kd PxGw== 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=Obry1JNu0BpWidQsYGowwyHtgZaruqpTmTtFQume0Ig=; b=kyf8Y7INdN3l2ZoChdGplGirE9E1zHVLLV9XMPAMVW4nCZkPSZ/gCTyNQKuEbTfOOC G1kvSf3ckBdWOehdduGX6SMP5pAAxSag0U83zqKFoWhPUa1rsWO0I79yg4diQquchJhN HfOOWk9wOZw1MyHixFitPOXUKNZnoVCG0auU2aQBhzTZjR3OpiOdBmXHOOAzOQo/47nn zoEhvPEScAUZdC/aS8zOyZHwbO9D+uJGxPUsYouNaTUVtTenr19K4D41NcazyIvqZa+F qqi2Ah3eZILuDEDdQMd8dcEEvx8kTPdNnqhu0HdRNAiYzljqZ4TDYwMQJzgsHliUbdS2 MZOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IiamJ0b8; 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 i2si3109866pgt.354.2018.01.26.07.30.09; Fri, 26 Jan 2018 07:30:24 -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=IiamJ0b8; 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 S1753602AbeAZP1p (ORCPT + 99 others); Fri, 26 Jan 2018 10:27:45 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:38914 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbeAZP1h (ORCPT ); Fri, 26 Jan 2018 10:27:37 -0500 Received: by mail-pg0-f68.google.com with SMTP id w17so460169pgv.6 for ; Fri, 26 Jan 2018 07:27:37 -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=Obry1JNu0BpWidQsYGowwyHtgZaruqpTmTtFQume0Ig=; b=IiamJ0b8fhlrk74pz6nwouMYmvBB+abvi6qMzv/Pafpr/kxSlcOOv+s3Ati1sFn5kh yl2sn7AdPANMnPMjpDyoqb+4l3qPKde62OWSedbh7IxtV5bwy7gHhXsba1RUrFA/hmqZ mhErsHXZgCGNkDA6UG3DgLxWgIiepQ7rwodUE8KvQfXnOJWLo9wD7VwN4O3T0CaZh+MQ aGmJY1BNjKQmvYZ9kWH3+RfWxF8z9lqCni31C7UzNZbEzAKYS381Afoib9EQcS7oAMDK Ew4wl63EnPGh3TlOnmExJL5GuAUUX6rAMebo1DDvf0m/O1OJXaY9FETVfsSqpHBT9sGk OviQ== 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=Obry1JNu0BpWidQsYGowwyHtgZaruqpTmTtFQume0Ig=; b=SfRk6vHkbm3Fofp0GmZnFS/QODzp3zZx0R1CmKX0fRSfG1VRtTYSdy0re+4DvMrC8G XT2wh3S6RZeLfwv07JZz70gViFUYLqIBOtwwIUTLCpcrMlo97/J0L+NSsK4obKrxIC8A 0qmgG7VIsshQUzaqBwYE3VHWFzSflZsupUDEanV9FS9fUa0rJkOny/RCGmGpB12mbl6W 2RwTwHgngX51j5wlK/lVifWLoMWS04arBKpXkJm5bmcVMayk449aB8+KuWreapktEGl5 V3gf7LyGQu1gsqdO/uYTJGZDE2O8zWEaRUpkvah6iF5V1zU5m8v69Hn3PgVg04LDi/DJ nBvQ== X-Gm-Message-State: AKwxytd5Hx3aS8rlTcTz9+HzQsPuUYTzCTqmbb6qONJML+qz0rBTdBUU QFXYpLA3xsZAOSg9Ci57lv4= X-Received: by 10.101.81.197 with SMTP id i5mr16095921pgq.220.1516980457575; Fri, 26 Jan 2018 07:27:37 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id f79sm20929005pfd.103.2018.01.26.07.27.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:27:37 -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 2/3] block: mtip32xx: Replace mdelay with msleep in mtip_service_thread Date: Fri, 26 Jan 2018 23:32:11 +0800 Message-Id: <1516980732-7931-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_service_thread() 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_service_thread() calls wait_event_interruptible(), so it indicates that mtip_hw_init() 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..1264c98 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -2807,7 +2807,7 @@ static int mtip_service_thread(void *data) to = jiffies + msecs_to_jiffies(5000); do { - mdelay(100); + msleep(100); } while (atomic_read(&dd->irq_workers_active) != 0 && time_before(jiffies, to)); -- 1.7.9.5