public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Steffen Maier <maier@linux.ibm.com>
To: Bart Van Assche <bvanassche@acm.org>,
	linux-scsi <linux-scsi@vger.kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	Sachin Sant <sachinp@linux.ibm.com>,
	Hannes Reinecke <hare@suse.de>, Martin Wilck <mwilck@suse.com>,
	Benjamin Block <bblock@linux.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: kernel BUG scsi_dh_alua sleeping from invalid context && kernel WARNING do not call blocking ops when !TASK_RUNNING
Date: Mon, 16 Jan 2023 19:12:51 +0100	[thread overview]
Message-ID: <61abebf1-4c92-a6eb-5d27-5ad223d85f46@linux.ibm.com> (raw)
In-Reply-To: <228d2351-e0ff-e743-6005-3ac0f0daf637@acm.org>

Hi Bart,

On 1/16/23 18:55, Bart Van Assche wrote:
> On 1/16/23 06:59, Steffen Maier wrote:
>> since a few days/weeks, we sometimes see below alua and sleep related kernel 
>> BUG and WARNING (with panic_on_warn) in our CI.
>>
>> It reminds me of
>> [PATCH 0/2] Rework how the ALUA driver calls scsi_device_put()
>> https://lore.kernel.org/linux-scsi/166986602290.2101055.17397734326843853911.b4-ty@oracle.com/
>>
>> which I thought was the fix and went into 6.2-rc(1?) on 2022-12-14 with
>> [GIT PULL] first round of SCSI updates for the 6.1+ merge window
>> https://lore.kernel.org/linux-scsi/b2e824bbd1e40da64d2d01657f2f7a67b98919fb.camel@HansenPartnership.com/T/#u
>>
>> Due to limited history, I cannot tell exactly when problems started and 
>> whether it really correlates to above.
>>
>> Test workload are all kinds of coverage tests for zfcp recovery including 
>> scsi device removal and/or rescan.
>>
>> [ 4569.045992] BUG: sleeping function called from invalid context at 
>> drivers/scsi/device_handler/scsi_dh_alua.c:992

> Thanks for your report and also for having included this call trace. Is my 
> understanding correct that alua_rtpg_queue+0x3c refers to the might_sleep() 
> near the start of alua_rtpg_queue()? If so, please help with testing the 
> following patch:
> 
> diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c 
> b/drivers/scsi/device_handler/scsi_dh_alua.c
> index 49cc18a87473..79afa7acdfbc 100644
> --- a/drivers/scsi/device_handler/scsi_dh_alua.c
> +++ b/drivers/scsi/device_handler/scsi_dh_alua.c
> @@ -989,8 +989,6 @@ static bool alua_rtpg_queue(struct alua_port_group
>       int start_queue = 0;
>       unsigned long flags;
> 
> -    might_sleep();
> -
>       if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev))
>           return false;
> 
> 
> I'm proposing this change because the context from which a request is queued 
> should hold a reference on 'sdev' while a request is in progress so 
> alua_check_sense() should not trigger the scsi_device_put() call in 
> alua_rtpg_queue().

How would removing this check solve the other and seemingly more fatal (even 
without panic_on_warn) WARNING?:

[ 4760.878107] do not call blocking ops when !TASK_RUNNING; state=2 set at 
[<000000017ed2c0fa>] __wait_for_common+0xa2/0x240


FWIW, it seems we only seem to get such reports for debug kernel builds (not 
sure which kconfig options are relevant) but not for production / performance 
builds.

-- 
Mit freundlichen Gruessen / Kind regards
Steffen Maier

Linux on IBM Z and LinuxONE

https://www.ibm.com/privacy/us/en/
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschaeftsfuehrung: David Faller
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


  reply	other threads:[~2023-01-16 18:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 14:59 kernel BUG scsi_dh_alua sleeping from invalid context && kernel WARNING do not call blocking ops when !TASK_RUNNING Steffen Maier
2023-01-16 16:57 ` Martin Wilck
2023-01-16 17:48   ` Bart Van Assche
2023-01-16 17:58     ` Martin Wilck
2023-01-17  9:28     ` Martin Wilck
2023-01-17 18:50       ` Bart Van Assche
2023-01-17 21:48         ` Martin Wilck
2023-01-17 21:52           ` Bart Van Assche
2023-01-17 22:03             ` Martin Wilck
2023-01-18  0:29               ` Bart Van Assche
2023-01-18  8:45                 ` Martin Wilck
2023-01-18 16:17                 ` Steffen Maier
2023-01-24 11:16                   ` Steffen Maier
2023-01-24 11:36                     ` Martin Wilck
2023-01-16 17:55 ` Bart Van Assche
2023-01-16 18:12   ` Steffen Maier [this message]
2023-01-16 18:31     ` Bart Van Assche
2023-01-17  7:46   ` Martin Wilck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61abebf1-4c92-a6eb-5d27-5ad223d85f46@linux.ibm.com \
    --to=maier@linux.ibm.com \
    --cc=bblock@linux.ibm.com \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mwilck@suse.com \
    --cc=sachinp@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox