From patchwork Fri Jun 10 21:36:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 633968 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rRFqp56bmz9sdb for ; Sat, 11 Jun 2016 07:36:54 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751382AbcFJVgx (ORCPT ); Fri, 10 Jun 2016 17:36:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56327 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752100AbcFJVgw (ORCPT ); Fri, 10 Jun 2016 17:36:52 -0400 Received: from pps.filterd (m0082756.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5ALXikb005866 for ; Fri, 10 Jun 2016 17:36:51 -0400 Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) by mx0a-001b2d01.pphosted.com with ESMTP id 23g1eenevs-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Jun 2016 17:36:51 -0400 Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Jun 2016 17:36:50 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Jun 2016 17:36:47 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: brking@linux.vnet.ibm.com X-IBM-RcptTo: tj@kernel.org; linux-ide@vger.kernel.org; linux-scsi@vger.kernel.org Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 7DFE6C9003E; Fri, 10 Jun 2016 17:36:38 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u5ALak3j38535264; Fri, 10 Jun 2016 21:36:46 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81A65AE04B; Fri, 10 Jun 2016 17:36:46 -0400 (EDT) Received: from [9.10.86.84] (unknown [9.10.86.84]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 51801AE03C; Fri, 10 Jun 2016 17:36:46 -0400 (EDT) Subject: [RFC] [PATCH 1/3] ipr: Wait to do async scan until scsi host is initialized To: Tejun Heo , "linux-scsi@vger.kernel.org" , linux-ide References: <57470450.3070000@linux.vnet.ibm.com> <575B3215.5070602@linux.vnet.ibm.com> From: Brian King Date: Fri, 10 Jun 2016 16:36:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <575B3215.5070602@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061021-0044-0000-0000-0000005D0050 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061021-0045-0000-0000-00000471FFDF Message-Id: <575B32EE.8080403@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-10_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606100240 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org When performing an async scan, make sure the kthread doing scanning doesn't start before the scsi host is fully initialized. Signed-off-by: Brian King --- drivers/scsi/ipr.c | 9 +++++++++ drivers/scsi/ipr.h | 1 + 2 files changed, 10 insertions(+) diff -puN drivers/scsi/ipr.c~ipr_async_scan_fixup drivers/scsi/ipr.c --- linux-2.6.git/drivers/scsi/ipr.c~ipr_async_scan_fixup 2016-06-01 21:04:14.088698640 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.c 2016-06-10 15:35:56.738201739 -0500 @@ -3287,6 +3287,11 @@ static void ipr_worker_thread(struct wor return; } + if (!ioa_cfg->scan_enabled) { + spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); + return; + } + restart: do { did_work = 0; @@ -10360,6 +10365,7 @@ static void ipr_remove(struct pci_dev *p static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) { struct ipr_ioa_cfg *ioa_cfg; + unsigned long flags; int rc, i; rc = ipr_probe_ioa(pdev, dev_id); @@ -10412,7 +10418,10 @@ static int ipr_probe(struct pci_dev *pde } } + spin_lock_irqsave(ioa_cfg->host->host_lock, flags); + ioa_cfg->scan_enabled = 1; schedule_work(&ioa_cfg->work_q); + spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags); return 0; } diff -puN drivers/scsi/ipr.h~ipr_async_scan_fixup drivers/scsi/ipr.h --- linux-2.6.git/drivers/scsi/ipr.h~ipr_async_scan_fixup 2016-06-01 21:04:17.186678232 -0500 +++ linux-2.6.git-bjking1/drivers/scsi/ipr.h 2016-06-10 15:35:56.739201727 -0500 @@ -1475,6 +1475,7 @@ struct ipr_ioa_cfg { u8 in_ioa_bringdown:1; u8 ioa_unit_checked:1; u8 dump_taken:1; + u8 scan_enabled:1; u8 scan_done:1; u8 needs_hard_reset:1; u8 dual_raid:1;