NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: "Verma, Vishal L" <vishal.l.verma@intel.com>
Cc: "david@redhat.com" <david@redhat.com>,
	 "Hocko, Michal" <mhocko@suse.com>,
	 "Jiang, Dave" <dave.jiang@intel.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 "osalvador@suse.de" <osalvador@suse.de>,
	 "aneesh.kumar@linux.ibm.com" <aneesh.kumar@linux.ibm.com>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	 "Williams, Dan J" <dan.j.williams@intel.com>,
	 "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	 "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	 "nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>,
	 "dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	 "jmoyer@redhat.com" <jmoyer@redhat.com>,
	"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v5 2/2] dax/kmem: allow kmem to add memory with memmap_on_memory
Date: Tue, 17 Oct 2023 13:54:50 +0800	[thread overview]
Message-ID: <874jip94k5.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <7a29c85bda2543a0f31d575ced3e57eb93063fc3.camel@intel.com> (Vishal L. Verma's message of "Tue, 17 Oct 2023 13:44:27 +0800")

"Verma, Vishal L" <vishal.l.verma@intel.com> writes:

> On Tue, 2023-10-17 at 13:18 +0800, Huang, Ying wrote:
>> "Verma, Vishal L" <vishal.l.verma@intel.com> writes:
>>
>> > On Thu, 2023-10-05 at 14:16 -0700, Dan Williams wrote:
>> > > Vishal Verma wrote:
>> > > >
>> > <..>
>> >
>> > > > +
>> > > > +       rc = kstrtobool(buf, &val);
>> > > > +       if (rc)
>> > > > +               return rc;
>> > >
>> > > Perhaps:
>> > >
>> > > if (dev_dax->memmap_on_memory == val)
>> > >         return len;
>> > >
>> > > ...and skip the check below when it is going to be a nop
>> > >
>> > > > +
>> > > > +       device_lock(dax_region->dev);
>> > > > +       if (!dax_region->dev->driver) {
>> > >
>> > > Is the polarity backwards here? I.e. if the device is already
>> > > attached to
>> > > the kmem driver it is too late to modify memmap_on_memory policy.
>> >
>> > Hm this sounded logical until I tried it. After a reconfigure-
>> > device to
>> > devdax (i.e. detach kmem), I get the -EBUSY if I invert this check.
>>
>> Can you try to unbind the device via sysfs by hand and retry?
>>
> I think what is happening maybe is while kmem gets detached, the device
> goes back to another dax driver (hmem in my tests). So either way, the
> check for if (driver) or if (!driver) won't distinguish between kmem
> vs. something else.
>
> Maybe we just remove this check? Or add an explicit kmem check somehow?

I think it's good to check kmem explicitly here.

--
Best Regards,
Huang, Ying

      reply	other threads:[~2023-10-17  5:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 18:31 [PATCH v5 0/2] mm: use memmap_on_memory semantics for dax/kmem Vishal Verma
2023-10-05 18:31 ` [PATCH v5 1/2] mm/memory_hotplug: split memmap_on_memory requests across memblocks Vishal Verma
2023-10-05 21:20   ` Dan Williams
2023-10-06 16:46     ` Verma, Vishal L
2023-10-06 12:52   ` David Hildenbrand
2023-10-06 22:01     ` Verma, Vishal L
2023-10-09 15:15       ` David Hildenbrand
2023-10-07  8:55   ` Huang, Ying
2023-10-09 15:04     ` David Hildenbrand
2023-10-12  5:53       ` Verma, Vishal L
2023-10-12  8:40         ` David Hildenbrand
2023-10-16 18:19           ` Verma, Vishal L
2023-10-05 18:31 ` [PATCH v5 2/2] dax/kmem: allow kmem to add memory with memmap_on_memory Vishal Verma
2023-10-05 21:16   ` Dan Williams
2023-10-17  0:31     ` Verma, Vishal L
2023-10-17  5:18       ` Huang, Ying
2023-10-17  5:44         ` Verma, Vishal L
2023-10-17  5:54           ` Huang, Ying [this message]

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=874jip94k5.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david@redhat.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=vishal.l.verma@intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).