From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D36EA3BE652 for ; Wed, 8 Jul 2026 16:24:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783527881; cv=none; b=ZrZ3FGOhVSFkev61ks/0y1i4Zu7o82Kab6I3bioXhzyX1H8nkOecsdhnGmM6qJ5yqB8XRQLIjXJh8vuvI5/HpnJvw09S3WEXRmS/Umm0WAf3NpGVFzsj2Wk4hPZtyYPIJJt5Th+lGKH1t+nCZtnxTGG/x43kau1Ui4vKUMgfouA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783527881; c=relaxed/simple; bh=ctHH6AeqN8ieWSSWnaVJOLb16nkCvz2lOMAZwspUqms=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SNk6cGzjz7Fh+DTdcoFMX8lmfIxff36KXdErwxYDCmoP98Zper6jzr0kfYvmVfYQUnMZH4+2jywngleMFJnOUP8dRTaTT+nAsStjLEhAx2SjhY6eysq885awc/l5RCrhYInEk5DKSVBQ9YXXDBVRPM4rGNqA70AnETs8V4eTUsI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 5975668BFE; Wed, 8 Jul 2026 18:24:35 +0200 (CEST) Date: Wed, 8 Jul 2026 18:24:35 +0200 From: Christoph Hellwig To: Joseph Qi Cc: Pankaj Gupta , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, Christoph Hellwig , Baokun Li Subject: Re: [PATCH] virtio-pmem: use GFP_NOIO for flush bio allocation Message-ID: <20260708162435.GB2502@lst.de> References: <20260708124238.2817165-1-joseph.qi@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260708124238.2817165-1-joseph.qi@linux.alibaba.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, Jul 08, 2026 at 08:42:38PM +0800, Joseph Qi wrote: > diff --git a/drivers/nvdimm/nd_virtio.c b/drivers/nvdimm/nd_virtio.c > index 4176046627beb..081370aac6317 100644 > --- a/drivers/nvdimm/nd_virtio.c > +++ b/drivers/nvdimm/nd_virtio.c > @@ -117,7 +117,7 @@ int async_pmem_flush(struct nd_region *nd_region, struct bio *bio) > if (bio && bio->bi_iter.bi_sector != -1) { > struct bio *child = bio_alloc(bio->bi_bdev, 0, > REQ_OP_WRITE | REQ_PREFLUSH, > - GFP_ATOMIC); > + GFP_NOIO); > > if (!child) > return -ENOMEM; This NULL check can go away now, and probaby should to avoid confusion. Also bio_alloc allocates from fs_bio_set, so if the incoming bio is from that, we can still deadlock. We'll need a separate bio_set for this to be deadlock free. disk->bio_split isn't otherwise used for the drivers/nvdimm/ driverss, so you might be able to repurpose that if you want to be creative.