Received: by 10.223.176.5 with SMTP id f5csp164191wra; Fri, 26 Jan 2018 20:14:39 -0800 (PST) X-Google-Smtp-Source: AH8x227JJwAKM0QYE7Qn1LOVoKzSeuol32aeCHm12htZSMNyRZw1lwOC3R3uufiy5eWgQGDTSblc X-Received: by 2002:a17:902:3a3:: with SMTP id d32-v6mr15718434pld.193.1517026479661; Fri, 26 Jan 2018 20:14:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517026479; cv=none; d=google.com; s=arc-20160816; b=vJDWGQa0G77NiLkdm1X6a0OUWb6OPQ0u9MNCEmrqJsdFu7cCeTcp2p+ism9gDS0D1u XhGqSwiOmxONbqwIpYIvN+e6xBiy1Tp31HeXDtBQ/QG6e2LLiQQmA2hPxLATnPBNcmew hvg4KXWDx53GEdlLs6zMBVhb3oIQ5rd3ZSd9I6owRoH2q4hn9myFMRujcipO+myfS4ua KkIwBwK6XrMBUoMv/AVSjV0TRrB/2kGyHSlKT3s6pSKklvHzrIPwlEaX5BG89S7eFNrr ZnzlEWKi8Tk7J0dEXZ7NTf88RIaMOizHnzQynFwBp93/doaPI3U8lOVBEwhSIusE+D6s 3Y/g== 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=6JjSAlijIRzD1C+g+ACXvNtv8GxrDMc2Zaj1whou7g8=; b=pZteXOvLPlk/7L/Q/tXVazs/w66Q5/VKFASenYUfJKg0efvEXD7GrfyJuo8gKB7KfU iqiJSk+V3NrdzTxCiSiQW7ytwDVeJoVW8f8mr+Eqr0mG0zIm3BqwVOMmtD3OWVGRUwP5 4NfdGYt9TqtAKnmEfV9xpJFaJWQJ2jUPqvGu00gn2TMJWGJvg4h2RibqYfYKO1rFH1qy wRjJ1kyrirwAfaN83Ti65dCYC++adzuowCwdqFDf7uMMxQJRvi6dIpvKYdx0SWbutmAz u87JnGvkjKN3d/ScnwYsVt0Le2GMeoCTa3OLS+qf+BE02bZztkwGzRF1ftAeYKwhbxx2 CJyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k0rMvs4M; 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 d10si3921802pgu.401.2018.01.26.20.14.25; Fri, 26 Jan 2018 20:14:39 -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=k0rMvs4M; 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 S1751964AbeA0ENv (ORCPT + 99 others); Fri, 26 Jan 2018 23:13:51 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:41430 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbeA0ENu (ORCPT ); Fri, 26 Jan 2018 23:13:50 -0500 Received: by mail-pg0-f66.google.com with SMTP id 136so1398645pgd.8 for ; Fri, 26 Jan 2018 20:13:50 -0800 (PST) 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=6JjSAlijIRzD1C+g+ACXvNtv8GxrDMc2Zaj1whou7g8=; b=k0rMvs4MBnlq5J2VoRwKByNYVQ4rssS718JbXkDHqGk6i+KXXHn/oiUzvYXtjmJshX VPc/DdkgjUNe7zLoQKAJaV3u7tcUUdktkYf/OzjdwbQAFgO4H3c4Vkckrc2tU0PTlUO2 CwRpb2Runi/Pc4HTXgXFhM+E3mFGIIXqiT7ch2wO7xPPUIoytPOpjE9DyxzbWld/9qd8 69Fc1qNGgIsGz8qVvQ6tAcHneciRb0C9q6keIiMUZKj9C9dlLgN/STnpQ7RUXCuib6OL B49V9OP8YylcxIa5NpY3IPOb5VsdNEgSUUm35xveTk9IjxXGyz0/yv01nkwrCFFHmUXK /1og== 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=6JjSAlijIRzD1C+g+ACXvNtv8GxrDMc2Zaj1whou7g8=; b=UyBHbIzni1swuTQppJ+Td55Yo769Uh/BjvPTO5e7viibd8Uw1GKmUXWkKgpODzLzsV INsIPuLiFyOi+dF/LD4i3TX5RdVZKg3qwVm+bJ5556advND9JQwlyYNjM49XIJU9KACD nKvdGlxqw5W3OqU5mozy0MUvnRcjwEWzrcvOJSYnKvAOjWm31nY8+b3Ba8bRSq4J09sW ypRlVdgiJcet2ih4I3ZecuO+fRe4YUApAMk2Oi4SkKVYxlhlImmCkluKeukJUdPe7Zet GvHEJxKHmtOkJofEF7+y2OLBapGscwj5ytkprv7EtwoADQAU7T5f6wBviVWXTwhsxkpE uOHw== X-Gm-Message-State: AKwxytcBiSvs6gc2b7WbxYVMKKsg4yXuHXTZav0RD++HB34/a/3D+5VS 3d2aZT6hfHWRQaKbzutqLsoUXE2y X-Received: by 10.98.100.139 with SMTP id y133mr20925228pfb.68.1517026429947; Fri, 26 Jan 2018 20:13:49 -0800 (PST) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.14? ([2402:f000:1:1501:200:5efe:a66f:460e]) by smtp.gmail.com with ESMTPSA id m83sm20956476pfk.107.2018.01.26.20.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 20:13:49 -0800 (PST) Subject: Re: [PATCH] block: paride: on26: Replace mdelay with msleep in on26_test_port To: Al Viro Cc: tim@cyberelk.net, linux-kernel@vger.kernel.org References: <1516981345-8202-1-git-send-email-baijiaju1990@gmail.com> <20180126173130.GZ13338@ZenIV.linux.org.uk> From: Jia-Ju Bai Message-ID: <2a3f0d10-824b-0d26-0046-6379a363b383@gmail.com> Date: Sat, 27 Jan 2018 12:13:30 +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: <20180126173130.GZ13338@ZenIV.linux.org.uk> 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/1/27 1:31, Al Viro wrote: > On Fri, Jan 26, 2018 at 11:42:25PM +0800, Jia-Ju Bai wrote: >> After checking all possible call chains to on26_test_port() here, >> my tool finds that this function is never called in atomic context, >> namely never in an interrupt handler or holding a spinlock. >> And on26_test_port() is only called by pi_probe_unit() that calls >> wait_event() through pi_claim(), >> so it indicates that on26_test_port() can call functions that can sleep. >> Thus mdelay can be replaced with msleep to avoid busy wait. > Sigh... Here's how I would've written it: > > " > on26_test_port() is never called from atomic contexts. > > It has no direct callers and it is reachable only via ->test_port. > ->test_port has only one user: > drivers/block/paride/paride.c:322: max = pi->proto->test_port(pi); > in pi_probe_unit(). That gets called only from pi_init(), called from > p{d,cd,f,t,g}_detect(), called from module_init stuff, all of the above > without entering atomic contexts along the way. > > Despite never getting called from atomic contexts, on26_test_port() contains > mdelay(100), i.e. busy-loops for 0.1s; that's neither nice nor needed, since > msleep() would serve just as well. > > Found by [reference to tool]" Okay, thanks for your patient guidance :) I will revise the description and send v2 patch, and follow the advice in my next patches. Thanks, Jia-Ju Bai