Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3593645ybt; Tue, 30 Jun 2020 06:52:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDnF+ylUQ5u/GCfPZsnzpR4yeCjVslWEFS1mfgqtlS8QvkhQSecoplljLXUMtZpYI1v2hf X-Received: by 2002:a50:b084:: with SMTP id j4mr23442678edd.131.1593525124743; Tue, 30 Jun 2020 06:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593525124; cv=none; d=google.com; s=arc-20160816; b=UVTZ/cTvSl0YeosTsZ1YdiVOmY/yUNUfNUbfUU6ab4fJdFvpvCodqKeHBG4GeQQs6x cWBw8Rx42qqrhQlagCEh2qLCXGAQDWFtO6L09Vg+hifF8bC+FRTMnSH+WpDo5jUER8St 8sUhtakZmXzc10GRjgm+RJzEL9kLpty0UwtxvT59sUJUPIsbHCguserdMLjNuekXhKQi eW91KWdKEWmvrq2PIeFaKb39uMWUFWuxujZASfuflt2aNMIWQTKXz5iHsb97xcvUKFFr aBW6aelAVHqApF1YfBevP7pNDmfeszczUpDeMKhC/+hSZxTvJuhiw7L7kmBfqKdfxuJT lA4g== 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 :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=WB0Yd27fftKZItOj7IqAPzZFMcB8Kks9E0khozHUDtU=; b=hEJ/XISK4IE7jWGfOCgdCkOk9yQ0j5+QEAoyYDc/1R0Qcy6zOoeWETJrsL0gjLVm3X fDn7JreaUSROFBOoYV1ZmHTad//lN3pX6tfUDfvAyK2sS0IsxF4IVI4Phy/NETIZrGMg v4ztuSaPaEJqVkTvzdecTKwFAz5aMvjyqM2XDIYlhZFYnFPe0dLv0YaZnlxwg+hcBfNa xCnQlMCowUIRvi9KTgApfTTukvyQnBEYafS2MkE+cWPbQ8YQDBi6S+lxtDu4Lw1dXE2q mha7InCjArqMXYDTgDFO3ny3NEKlFFYvMQ2qjN/9V8/j+JcI/3VGhd/pw/y1RlYfya1V xmZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MQwn1SCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x15si1745959edj.153.2020.06.30.06.51.41; Tue, 30 Jun 2020 06:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MQwn1SCd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732375AbgF3NcV (ORCPT + 99 others); Tue, 30 Jun 2020 09:32:21 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:60222 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgF3NcV (ORCPT ); Tue, 30 Jun 2020 09:32:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593523939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WB0Yd27fftKZItOj7IqAPzZFMcB8Kks9E0khozHUDtU=; b=MQwn1SCdHOer/dOz6NgZwkgHDBt0gbjZGjbOdQx7LW3errSxNqop6h7FtvO8Ee/tZoSo+s 7cPwbK2TWxyM8rG2HVWg4vFQqKszgCyKRmQ/Glc0+eb+W/2Y3AdMsPVvIs+UTH0yNG75aW P6Qzr+IsnZ355nPDIUVdLd9PNBNXuHU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-4OYjGvZnMpSewXQZT9Dgkg-1; Tue, 30 Jun 2020 09:32:14 -0400 X-MC-Unique: 4OYjGvZnMpSewXQZT9Dgkg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49F6D10059A1; Tue, 30 Jun 2020 13:32:13 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4D6E5D9E7; Tue, 30 Jun 2020 13:32:01 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 05UDW1KX014784; Tue, 30 Jun 2020 09:32:01 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 05UDW16L014771; Tue, 30 Jun 2020 09:32:01 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 30 Jun 2020 09:32:01 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Michal Suchanek cc: linux-nvdimm@lists.01.org, "Aneesh Kumar K.V" , Jan Kara , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Pankaj Gupta , "Michael S. Tsirkin" , Yuval Shaia , Cornelia Huck , Jakub Staron , linux-kernel@vger.kernel.org Subject: Re: [PATCH] dm writecache: reject asynchronous pmem. In-Reply-To: <20200630123528.29660-1-msuchanek@suse.de> Message-ID: References: <20200630123528.29660-1-msuchanek@suse.de> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 Jun 2020, Michal Suchanek wrote: > The writecache driver does not handle asynchronous pmem. Reject it when > supplied as cache. > > Link: https://lore.kernel.org/linux-nvdimm/87lfk5hahc.fsf@linux.ibm.com/ > Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver") > > Signed-off-by: Michal Suchanek > --- > drivers/md/dm-writecache.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c > index 30505d70f423..57b0a972f6fd 100644 > --- a/drivers/md/dm-writecache.c > +++ b/drivers/md/dm-writecache.c > @@ -2277,6 +2277,12 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) > > wc->memory_map_size -= (uint64_t)wc->start_sector << SECTOR_SHIFT; > > + if (!dax_synchronous(wc->ssd_dev->dax_dev)) { > + r = -EOPNOTSUPP; > + ti->error = "Asynchronous persistent memory not supported as pmem cache"; > + goto bad; > + } > + > bio_list_init(&wc->flush_list); > wc->flush_thread = kthread_create(writecache_flush_thread, wc, "dm_writecache_flush"); > if (IS_ERR(wc->flush_thread)) { > -- Hi Shouldn't this be in the "if (WC_MODE_PMEM(wc))" block? WC_MODE_PMEM(wc) retrurns true if we are using persistent memory as a cache device, otherwise we are using generic block device as a cache device. Mikulas