Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3759378imu; Mon, 14 Jan 2019 08:32:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN76Y1WkebAodpmn8YFvbfptFajaNVjrsJsWHXV/lP84I68i9mHXPJ5g9PX4ispTStf3c2OG X-Received: by 2002:a17:902:7614:: with SMTP id k20mr26559012pll.285.1547483574941; Mon, 14 Jan 2019 08:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483574; cv=none; d=google.com; s=arc-20160816; b=XsJIIGDpnl6f3pPPlnM9epSH2Z/+3iK7K6qF52gvlLHLoepzyMfNPU5n0i+xdvraZv OFVyjnqIG0fb9EKoOifql3k4zmW1FYdVfbZRh0VJhOH9YzX2VsgoOFW+Ga7I/S5AXxyg 1Y3SZXMsAZXtSuOU4u4RzLDMwc4sAAnJJciYu/OtoqCg0Gpjt2xs4BQ4dD3ECSpZ/rj9 /+TXEP7Q8G7Mb6OOehe/mJQkJSotCwA1CiaOA1Cn3pqB0glll1tksEfeIi3XULKXpmBO 26g+06qSxnwUwipOJ8TpY3F2d8d+Gvde53rOHHXGQ7Uv1aNkupMigXxbuHJfoO3ARfuo 1S2w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to; bh=MsI35KWIztn0ikauW8C59aeFGaskwb5o86JBFwuJ5Yg=; b=eG2Ua3+MRjgnGWLDm2OEVDFCN7erps4JYFV6jBGzG9pr7iRb1C9h5K3rQIz/r80/9x Iia4SaKOFHQ7cgYIseVhD2o14jnzlXQk/7b3J9t8iyXcSFrFxyFmIAODKm5S1Hzi8nmI IX7wWQUSLJdzEL/CkRAt01MMiQg6qxQmSpGesM+dLNbau2ebdqTf5zHHqWYdL8QhGJWD 6XqWE0OsTb886Y0NNjHm7DGF+cnwN4Vaw+oyf085mjV02rTfdeFkW+UmelWSEU9gFZB/ V5QUVQTIL75rTg5kK9/ZQI3e7sdBPILqvcAR4nHLH5SEjKR6PMoZP1KnhMka5bDdtwNl 2Dhg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32si664644ple.72.2019.01.14.08.32.39; Mon, 14 Jan 2019 08:32:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726749AbfANQb3 (ORCPT + 99 others); Mon, 14 Jan 2019 11:31:29 -0500 Received: from smtp.infotech.no ([82.134.31.41]:58345 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbfANQb2 (ORCPT ); Mon, 14 Jan 2019 11:31:28 -0500 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id EC63120419A; Mon, 14 Jan 2019 17:31:25 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IMAFZuxzB1pv; Mon, 14 Jan 2019 17:31:24 +0100 (CET) Received: from [192.168.48.23] (host-192.252-161-233.dyn.295.ca [192.252.161.233]) by smtp.infotech.no (Postfix) with ESMTPA id 0D46D204164; Mon, 14 Jan 2019 17:31:22 +0100 (CET) Reply-To: dgilbert@interlog.com Subject: Re: [PATCH] scsi: wd719x Replace GFP_KERNEL with GFP_ATOMIC in wd719x_chip_init To: Christoph Hellwig , wangbo Cc: linux-kernel@vger.kernel.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, wang.bo116@zte.com.cn, Ondrej Zary References: <1547479489-11560-1-git-send-email-wdjjwb@163.com> <20190114152943.GA10454@infradead.org> From: Douglas Gilbert Message-ID: Date: Mon, 14 Jan 2019 11:31:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190114152943.GA10454@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-01-14 10:29 a.m., Christoph Hellwig wrote: > On Mon, Jan 14, 2019 at 11:24:49PM +0800, wangbo wrote: >> wd719x_host_reset get spinlock first then call wd719x_chip_init, >> so replace GFP_KERNEL with GFP_ATOMIC in wd719x_chip_init. > > Please move the allocation outside the lock instead. GFP_ATOMIC > DMA allocations are generally a bad idea and should be avoided where > we can. > > More importantly we should never actually trigger the allocation > under the lock as far as fw_virt will always be set already > in that case. > > So I think you can safely move the request firmware + allocation > + memcpy from wd719x_chip_init to wd719x_board_found, but I'd rather > have Ondrej review that plan. Further to this, the result of holding a lock (probably with _irqsave() tacked onto it) during a GFP_KERNEL is a message like this in the log: hrtimer: interrupt took 1084 ns It is not always easy to find since it is a "_once" message. The sg v3 driver (the one in production) produces these. I have been able to stamp them out by taking care in the sg v4 driver (in testing) around allocations. It also meant adding a new state in my state machine to fend off "bad things" happening to that object while it is unlocked. So there may be a cost to dropping the lock. Doug Gilbert