Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1928138imm; Thu, 24 May 2018 03:05:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoK0A0kec+LiMWjNIyBspPOSoZPomDUyap+7B9uyf4zKr3pj2PzxaoXTiuzCrtmCBuOjXZc X-Received: by 2002:a65:4a03:: with SMTP id s3-v6mr5255312pgq.376.1527156303287; Thu, 24 May 2018 03:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156303; cv=none; d=google.com; s=arc-20160816; b=juPE+cXxZjtyZmBHxt/5o/hVsuj+/aS6jfmgYMrKPyPXq2e3DA1a8MJzenkkPKtjzG 6jvVCHbpYfylNBdGn8F40dbqQkovwdg42nbMvG4n6TcVVOEbSEi2bRkvChf2zzaFCbNU xeROElRivp7OHdUNgWZLJItIwrKgdUEk0U40OoxX+RQd5OL+UjkUAhofjDMbF6jDqb4o u25yLbAFpHTYoKjdNSBU/A2oXigguy2mHsBlG5xp1OI7B/2sE1PR9i/8Z4ZUsPx/aFZe spD3gTmzRPF0Gv6ci7IQK2g1hJ1ClVFkWXZvJVD15AVbjcYykFz9bti2ef2dpAXryIaD Qt3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=4hfdmhTzl9gBQsj7AucV4n3y9N/FqRdYmZZRnejaoMg=; b=ioRaxTonWFhVudxuJGezjiPMV4Ra/d42FwocncpyRJCD+CLhPRIN2wVPO7lC66jWZU LOtpXudbJxvRbjdCYKYV5amhelGkZ6EeAEH2QYtVHIh1Esgq6oO06LV7gskRv1OXNKn3 AzBKGEpoGlybYZifrG5KZPoHgPL3K5i6yX9N8ud2Fm0hScnz6J7+trY+x/3mpqrKe8/R PYuMiGYOKBGCv3OtAgc9kJ3cBYVi4uX+7carJIU/gAAH0Yfed3zzScdZf8MxRJv8vDO1 ElikWBN5r6nvhi90KE0WQ5RZNDCNdKfXHP2M/S5mpsz58flRIw6tS3kgThfck3BxHQkl cyDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TIwAYQmo; 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 j15-v6si329749pga.252.2018.05.24.03.04.48; Thu, 24 May 2018 03:05:03 -0700 (PDT) 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=@kernel.org header.s=default header.b=TIwAYQmo; 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 S1031370AbeEXKEB (ORCPT + 99 others); Thu, 24 May 2018 06:04:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031344AbeEXKD5 (ORCPT ); Thu, 24 May 2018 06:03:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F83420892; Thu, 24 May 2018 10:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156236; bh=sfwweI/yyTbBvl+MJzNbtRU2l8DXjiwFmY5Ccfo5lJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TIwAYQmoAJkSVLMbT8FKr1c964CzDzOtYBPPoTwtl3i7NkEzdhC4LqcFVtJX6Q0Uc 6wg4J4abljZqekjyjNeEB38cUUxrCRCsLfa3pTmEjmHGk+9gTM2zPGCg07VuE5eeTm rNmG1alHkuzoFSAiIbIPc+U845O3RY8jbCbadgok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dick Kennedy , James Smart , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.16 114/161] scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing Date: Thu, 24 May 2018 11:38:59 +0200 Message-Id: <20180524093031.975849318@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Smart [ Upstream commit 161df4f09987ae2e9f0f97f0b38eee298b4a39ff ] During link bounce testing in a point-to-point topology, the host may enter a soft lockup on the lpfc_worker thread: Call Trace: lpfc_work_done+0x1f3/0x1390 [lpfc] lpfc_do_work+0x16f/0x180 [lpfc] kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70 The driver was simultaneously setting a combination of flags that caused lpfc_do_work()to effectively spin between slow path work and new event data, causing the lockup. Ensure in the typical wq completions, that new event data flags are set if the slow path flag is running. The slow path will eventually reschedule the wq handling. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -696,8 +696,9 @@ lpfc_work_done(struct lpfc_hba *phba) phba->hba_flag & HBA_SP_QUEUE_EVT)) { if (pring->flag & LPFC_STOP_IOCB_EVENT) { pring->flag |= LPFC_DEFERRED_RING_EVENT; - /* Set the lpfc data pending flag */ - set_bit(LPFC_DATA_READY, &phba->data_flags); + /* Preserve legacy behavior. */ + if (!(phba->hba_flag & HBA_SP_QUEUE_EVT)) + set_bit(LPFC_DATA_READY, &phba->data_flags); } else { if (phba->link_state >= LPFC_LINK_UP || phba->link_flag & LS_MDS_LOOPBACK) {