From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B72C64E7B for ; Mon, 30 Nov 2020 13:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D26C120643 for ; Mon, 30 Nov 2020 13:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725902AbgK3N1P (ORCPT ); Mon, 30 Nov 2020 08:27:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:39240 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgK3N1P (ORCPT ); Mon, 30 Nov 2020 08:27:15 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EC535ABD2; Mon, 30 Nov 2020 13:26:33 +0000 (UTC) Date: Mon, 30 Nov 2020 14:26:33 +0100 From: Daniel Wagner To: Sebastian Andrzej Siewior Cc: linux-scsi@vger.kernel.org, Finn Thain , GR-QLogic-Storage-Upstream@marvell.com, Hannes Reinecke , Jack Wang , John Garry , linux-m68k@lists.linux-m68k.org, Manish Rangankar , Michael Schmitz , MPT-FusionLinux.pdl@broadcom.com, Nilesh Javali , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , Vikram Auradkar , Xiang Chen , Xiaofei Tan , "James E . J . Bottomley" , "Martin K . Petersen" , Thomas Gleixner , "Ahmed S . Darwish" Subject: Re: [PATCH 06/14] scsi: qla2xxx: init/os: Remove in_interrupt(). Message-ID: <20201130132633.ikv7vgoh64bagf4u@beryllium.lan> References: <20201126132952.2287996-1-bigeasy@linutronix.de> <20201126132952.2287996-7-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126132952.2287996-7-bigeasy@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-m68k@vger.kernel.org On Thu, Nov 26, 2020 at 02:29:44PM +0100, Sebastian Andrzej Siewior wrote: > From: "Ahmed S. Darwish" > > qla83xx_wait_logic() is used to control the frequency of device IDC lock > retries. If in_interrupt() is true, it does 20 loops of cpu_relax(). > Otherwise, it sleeps for 100ms and yields the CPU. > > While in_interrupt() is ill-defined and does not provide what the name > suggests, it is not needed here: that qla83xx_wait_logic() is exclusively > called by qla83xx_idc_lock() / unlock(), and they always run from > process context. Below is an analysis of all the idc lock/unlock callers, > in order of appearance: > > - qla_os.c: > qla83xx_nic_core_unrecoverable_work(), > qla83xx_idc_state_handler_work(), > qla83xx_nic_core_reset_work(), > qla83xx_service_idc_aen(), all workqueue context > > - qla_os.c: qla83xx_check_nic_core_fw_alive(), has msleep() > > - qla_os.c: qla83xx_set_drv_presence(), called once from > qla2x00_abort_isp(), which is bound to process-context ->abort_isp() > hook. It also invokes wait_for_completion_timeout() through the > chain qla2x00_configure_hba() => qla24xx_link_initialize() => > qla2x00_mailbox_command(). > > - qla_os.c: qla83xx_clear_drv_presence(), which is called from > qla2x00_abort_isp() discussed above, and from qla2x00_remove_one() > which is PCI process-context ->remove() hook. > > - qla_os.c: qla83xx_need_reset_handler(), has a one second msleep() in > a loop. > > - qla_os.c: qla83xx_device_bootstrap(), called only by > qla83xx_idc_state_handler(), which has multiple msleep() > invocations. > > - qla_os.c: qla83xx_idc_state_handler(), multiple msleep() > invocations. > > - qla_attr.c: qla2x00_sysfs_write_reset(), sysfs bin_attribute > ->write() hook, process context > > - qla_init.c: qla83xx_nic_core_fw_load() > => qla_init.c: qla2x00_initialize_adapter() > => bound to isp_operations ->initialize_adapter() hook > ** => qla_os.c: qla2x00_probe_one(), PCI ->probe() process ctx > > - qla_init.c: qla83xx_initiating_reset(), msleep() in a loop. > > - qla_init.c: qla83xx_nic_core_reset(), called by > qla83xx_nic_core_reset_work(), workqueue context. > > Remove the in_interrupt() check, and thus replace the entirety of > qla83xx_wait_logic() with an msleep(QLA83XX_WAIT_LOGIC_MS). > > Mark qla83xx_idc_lock() / unlock() with "Context: task, can sleep". > > Signed-off-by: Ahmed S. Darwish > Signed-off-by: Sebastian Andrzej Siewior > Cc: Nilesh Javali > Cc: GR-QLogic-Storage-Upstream@marvell.com Reviewed-by: Daniel Wagner