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 8EF1BC8300F for ; Mon, 30 Nov 2020 13:55:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4484C2085B for ; Mon, 30 Nov 2020 13:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726868AbgK3NzD (ORCPT ); Mon, 30 Nov 2020 08:55:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:39438 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726737AbgK3NzD (ORCPT ); Mon, 30 Nov 2020 08:55:03 -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 3408FACC4; Mon, 30 Nov 2020 13:54:21 +0000 (UTC) Date: Mon, 30 Nov 2020 14:54:20 +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 03/14] scsi: qla4xxx: qla4_82xx_crb_win_lock(): Remove in_interrupt(). Message-ID: <20201130135420.6aqgtodvbcv36piv@beryllium.lan> References: <20201126132952.2287996-1-bigeasy@linutronix.de> <20201126132952.2287996-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126132952.2287996-4-bigeasy@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-m68k@vger.kernel.org On Thu, Nov 26, 2020 at 02:29:41PM +0100, Sebastian Andrzej Siewior wrote: > From: "Ahmed S. Darwish" > > qla4_82xx_crb_win_lock() spins on a certain hardware state until it's > updated. At the end of each spin, if in_interrupt() is true, it does 20 > loops of cpu_relax(). Otherwise, it yields the CPU. > > The in_interrupt() macro is ill-defined as it does not provide what the > name suggests, and it does not catch the intended use-case here. > > qla4_82xx_crb_win_lock() is always invoked with scsi_qla_host::hw_lock > acquired, with disabled interrupts. If the caller is in process context, > as in qla4_82xx_need_reset_handler(), then in_interrupt() will return > false even though it is not allowed to call schedule(). > > Remove the in_interrupt() check. > > Change qla4_82xx_crb_win_lock() specification to a purely atomic > function. Mark it as static, remove its forward declaration, and move it > above its callers. To avoid hammering the PCI bus while spinning, use a > 10 micro-second delay instead of cpu_relax(). > > Fixes: f4f5df23bf72 ("[SCSI] qla4xxx: Added support for ISP82XX") > Signed-off-by: Ahmed S. Darwish > Signed-off-by: Sebastian Andrzej Siewior > Cc: Nilesh Javali > Cc: Manish Rangankar > Cc: Reviewed-by: Daniel Wagner