Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3855869imm; Mon, 30 Jul 2018 04:51:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcdSJ3Of5tA9WRbCavESU7gTq77Hw+6dSZPS0l/Mdd9tpL4xT1KbMmQbivV2jtiYQDGqzYy X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr16270251pld.289.1532951513462; Mon, 30 Jul 2018 04:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532951513; cv=none; d=google.com; s=arc-20160816; b=fwBtkFhzhVU7jNr7PVb7GSV15vKfKBZAv7YVmL95y3RqK27CEOSmQxZ7Cfj7fVXS0O //rx7MlXGJx8v53wglOJ5mVw9Q3jvPCUL/XJs766izyGgRq1ISYb9kLH4h1/rtO9wuJ+ XKpotlt3wFXCRs3CW8ZQyVpnqmzBpxyBgGGCvdM0wFkyPsnXwNeH5UQTXNps6Na+kiH0 ONTbdyy0jO1pd7HQFk2F1FSBd5b5ekb3du677ZvTbcrN8mynBk3Fkha2uUgWB2V/HOja rcCYbz1QH2+Vm/hisxQGGdqfOcowOXHJagKavr9497uoyyEI+wxb5au9lukGZCm+BrBO qGYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=D8ctQ78khWMhM/tyaqugYLndV1k+Qxb7LAij9Kq1Ic8=; b=fhlL+CBVqHIT9WQsOxztCvQEMa/XB+vFostcuaPDgR8VV11u4QzhCDhAHTFmJR2oKL wQ1K9eD7LF2Wuz+OnUrYF9/AOoSwP9OKUbEA4CGVxp422q1lS8ZZv71p/yJxBH3evy2i bYKIIMqHHrsUhuGWK3BRKQFNZNu8kbsaBNRiaWJ+uay9bAkw7fIWsTjubfvGMLFbsv5K bNzB15v3ehCte51y5U6/nRLVhJaUmw+55n4PEWQQCeLjfYkgNx36nSa1Gzq98MXnHrwV rI9gbGxBIyR2qZdu13bhQEiDzPGB0+Uvd6H0owdpYE47E//wD5YSol+MoEbc1K3xye6w wIGg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z64-v6si11134871pgb.79.2018.07.30.04.51.38; Mon, 30 Jul 2018 04:51:53 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728976AbeG3NYu (ORCPT + 99 others); Mon, 30 Jul 2018 09:24:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35946 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727478AbeG3NYu (ORCPT ); Mon, 30 Jul 2018 09:24:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 323387C6A9; Mon, 30 Jul 2018 11:50:13 +0000 (UTC) Received: from ming.t460p (ovpn-12-24.pek2.redhat.com [10.72.12.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 010A82026D68; Mon, 30 Jul 2018 11:50:08 +0000 (UTC) Date: Mon, 30 Jul 2018 19:50:03 +0800 From: Ming Lei To: Patrick Steinhardt Cc: Tomas Janousek , Ming Lei , Jens Axboe , linux-block , Linux Kernel Mailing List Subject: Re: [PATCH] block: fix NPE when resuming SCSI devices using blk-mq Message-ID: <20180730115002.GA6972@ming.t460p> References: <20180729094131.4kwuukzgfgtisgya@notes.lisk.in> <20180730075949.GA1755@xps.pks.im> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730075949.GA1755@xps.pks.im> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 11:50:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 30 Jul 2018 11:50:13 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'ming.lei@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 30, 2018 at 09:59:49AM +0200, Patrick Steinhardt wrote: > On Sun, Jul 29, 2018 at 11:41:31AM +0200, Tomas Janousek wrote: > > Hi, > > > > On Fri, Jul 13, 2018 at 09:41:41PM +0800, Ming Lei wrote: > > > Now runtime PM is disabled for blk-mq/scsi_mq, not sure how this issue is > > > triggered on your machine. > > > > While Patrick did miss the following patch: > > > > * 765e40b675a9 ("block: disable runtime-pm for blk-mq"; July 2017). > > > > there is at least one other way to trigger it -- enable laptop-mode-tools > > or tlp which enable runtime-pm for all devices. > > > > The "disable runtime-pm for blk-mq" only disables it _by_default_, but doesn't > > prevent it from being enabled again from user-space, which it is unless one > > manually blacklists sd devices from runtime-pm enablement. It's bitten a few > > people already: https://github.com/rickysarraf/laptop-mode-tools/issues/123 > > > > (I found this thread because I'm also getting the NULL pointer dereference at > > 00000000000001a8 on resume from suspend.) > > Huh, I did send out some more details on how I reproduce the > issue, but it seems like my mail didn't get through. While I > don't use laptop-mode-tools, I do have some custom hotplugging > scripts which do in fact enable runtime-PM for most devices. Now runtime PM is still enabled for sd/sr, and I believe the following patch is needed until we figure out one perfect way for supporting it well: diff --git a/block/blk-core.c b/block/blk-core.c index 03a4ea93a5f3..090b782df129 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3769,9 +3769,11 @@ EXPORT_SYMBOL(blk_finish_plug); */ void blk_pm_runtime_init(struct request_queue *q, struct device *dev) { - /* not support for RQF_PM and ->rpm_status in blk-mq yet */ - if (q->mq_ops) + /* Don't enable runtime PM for blk-mq until it is ready */ + if (q->mq_ops) { + pm_runtime_disable(dev); return; + } q->dev = dev; q->rpm_status = RPM_ACTIVE; Thanks, Ming