xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Haozhong Zhang <haozhong.zhang@intel.com>
To: Konrad Rzeszutek Wilk <konrad@kernel.org>
Cc: Juergen Gross <jgross@suse.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: Re: [RFC Design Doc v2] Add vNVDIMM support for Xen
Date: Thu, 4 Aug 2016 09:51:59 +0800	[thread overview]
Message-ID: <20160804015159.qpnkm2eme3oto2jv@hz-desktop> (raw)
In-Reply-To: <20160803231656.GA9828@localhost.localdomain>

On 08/03/16 19:16, Konrad Rzeszutek Wilk wrote:
> > > 1.4 clwb/clflushopt
> > > 
> > >  Writes to NVDIMM may be cached by caches, so certain flushing
> > >  operations should be performed to make them persistent on
> > >  NVDIMM. clwb is used in favor of clflushopt and clflush to flush
> > >  writes from caches to memory.
> > > 
> > >  Details of clwb/clflushopt can be found in Chapter 10 of [6].
> > 
> > Didn't that opcode get dropped in favour of poking in some register?
> 
> Nevermind. I got this confused with pcommit which was deprecated.
> 
> But looking at chapter 10.2.2 it mentions that to commit to
> persistent memory you need to use pcommit. So what is the story here?

The document has not been updated yet, though patches to revert
pcommit support for both Linux and Xen had been merged.

> .. snip...
> > >  A part not put in above figure is enabling guest clwb/clflushopt
> > >  which exposes those instructions to guest via guest cpuid.
> > 
> > And aren't those deprecated?
> 
> And again. Ignore that comment.
> .. snip..
> > > 4. Design of vNVDIMM in Xen
> > > 
> > >  As KVM/QEMU, our design currently only provides pmem vNVDIMM.
> > > 
> > >  Similarly to that in KVM/QEMU, enabling vNVDIMM in Xen is composed of
> > >  three parts:
> > >  (1) Guest clwb/clflushopt enabling,
> > >  (2) pmem address management, and
> > >  (3) Guest ACPI emulation.
> > > 
> > >  The rest of this section present the design of each part
> > >  respectively. The basic design principle to reuse existing code in
> > >  Linux NVDIMM driver, QEMU and Xen as much as possible.
> > > 
> > > 
> > > 4.1 Guest clwb/clflushopt Enabling
> > > 
> > >  The instruction enabling is simple and we do the same work as in KVM/QEMU:
> > >  - clwb/clflushopt are exposed to guest via guest cpuid.
> > > 
> > 
> > Again, isn't that deprecated and the new mechanism (pokng at some register)
> > has to be used?
> 
> So clflushopt can be used for flushing out a cacheline. But what
> to do about store in the non-volatile memory? I recall that you could
> do an sfence and then pcommit, which would be aking to an SCSI SYNC
> command.
> 
> But with pcommit being deprecated (albeit the URL you pointed too
> still lists pcommit) - at least in Xen and Linux - how do you
> enforce this wholesale flush?
>

After deprecating pcommit, at least one of following two approaches
should be provided by HW to guarantee persistent:

1) Asynchronous DRAM refresh (ADR)
   If the platform supports ADR, flush CPU cache lines (e.g. by
   clwb/clflushopt/clflush) will result result in flush write pending
   queues in memory controller to NVDIMM.
   
2) ACPI Flush Hint Address Structure
   If ACPI flush hint address structure is available for a NVDIMM
   region, software can write to that structure to flush any preceding
   stores to that NVDIMM region. (Section 5.2.25.8 of ACPI Spec 6.1)

ADR is preferred, as guest clwb/clflushopt/clflush do not introduce
VMEXITs.

However, I'm also going to emulate ACPI flush hint address structure
in case of the lack of ADR. Basically, guest writes to ACPI flush hint
address structure will be trapped to QEMU which will submit them to
the host ACPI flush hint address structure via Dom0 NVDIMM driver.

If neither ADR nor ACPI flush hint address structure is available,
persistent can not be guaranteed.

Thanks,
Haozhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-04  1:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  0:29 [RFC Design Doc v2] Add vNVDIMM support for Xen Haozhong Zhang
2016-07-18  8:36 ` Tian, Kevin
2016-07-18  9:01   ` Zhang, Haozhong
2016-07-19  0:58     ` Tian, Kevin
2016-07-19  2:10       ` Zhang, Haozhong
2016-07-19  1:57 ` Bob Liu
2016-07-19  2:40   ` Haozhong Zhang
2016-08-02 14:46 ` Jan Beulich
2016-08-03  6:54   ` Haozhong Zhang
2016-08-03  8:45     ` Jan Beulich
2016-08-03  9:37       ` Haozhong Zhang
2016-08-03  9:47         ` Jan Beulich
2016-08-03 10:08           ` Haozhong Zhang
2016-08-03 10:18             ` Jan Beulich
2016-08-03 21:25 ` Konrad Rzeszutek Wilk
2016-08-03 23:16   ` Konrad Rzeszutek Wilk
2016-08-04  1:51     ` Haozhong Zhang [this message]
2016-08-04  8:52   ` Haozhong Zhang
2016-08-04  9:25     ` Jan Beulich
2016-08-04  9:35       ` Haozhong Zhang
2016-08-04 14:51         ` Konrad Rzeszutek Wilk
2016-08-04 14:51     ` Konrad Rzeszutek Wilk
2016-08-05  6:25       ` Haozhong Zhang
2016-08-05 13:29         ` Konrad Rzeszutek Wilk

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=20160804015159.qpnkm2eme3oto2jv@hz-desktop \
    --to=haozhong.zhang@intel.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad@kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 NNTP newsgroup(s).