qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org, dan.j.williams@intel.com,
	Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 1/4] pc-dimm: add 'reserved-size' to reserve address range after the ending address
Date: Thu, 20 Apr 2017 12:54:19 +0200	[thread overview]
Message-ID: <20170420125419.0c0bf21f@nial.brq.redhat.com> (raw)
In-Reply-To: <20170411085700.3cgrvorievwcpc6r@hz-desktop>

On Tue, 11 Apr 2017 16:57:00 +0800
Haozhong Zhang <haozhong.zhang@intel.com> wrote:

> On 04/07/17 14:46 +0100, Stefan Hajnoczi wrote:
> > On Thu, Apr 06, 2017 at 06:46:49PM +0800, Haozhong Zhang wrote:  
> > > On 04/06/17 11:24 +0100, Stefan Hajnoczi wrote:  
> > > > On Fri, Mar 31, 2017 at 04:41:44PM +0800, Haozhong Zhang wrote:  
> > > > > If option 'reserved-size=RSVD' is present, QEMU will reserve an
> > > > > address range of size 'RSVD' after the ending address of pc-dimm
> > > > > device.
> > > > > 
> > > > > For the following example,
> > > > >     -object memory-backend-file,id=mem0,size=4G,...
> > > > >     -device nvdimm,id=dimm0,memdev=mem0,reserved-size=4K,...  
> > > > 
> > > > "reserved-size" is not a clear name.  I suggest calling the property
> > > > "num-flush-hints" (default 0).  QEMU can calculate the actual size in
> > > > bytes.
> > > > 
> > > >   -device nvdimm,num-flush-hints=1
I'm for this approach as well

I see that in patchset you hardcode cache line size to 64 for pc/q35
machines. What you could do is to introduce machine or cpu callback to
fetch cache line size and then you can calculate needed MMIO region size
using it and num-flush-hints in target independent way

> > > > 
> > > > QEMU will use one flush hint and reserve enough space (e.g. 1 page) for
> > > > the MMIO region.
> > > >  
> > > 
> > > Each flush hint can be as small as one cache line size which is also
> > > the size used in this patch series.
> > > 
> > > We need to calculate the size of all flush hints in pc_dimm_memory_plug(),
> > > because when building the flush hint address structure we need to know
> > > the address of flush hints.
> > > 
> > > IIUC, pc_dimm_memory_plug() is not specific to x86, so it's better
> > > take a general way to get the vcpu cache line size in pc_dimm_memory_plug(),
> > > which seemingly lacks in QEMU (though I believe it should be doable).
> > > 
> > > To make things simple, I leave the size decision to users, and check
> > > whether it's large enough when building the flush hint address
> > > structures in patch 4.  
> > 
> > Do you see my concern that "reserved-size" is not a good property?
> > 
> >  * How does the user choose a sensible value?  
> 
> A user has to calculate the size by himself by multiplying the number
> of flush hint address (currently it's hardcoded to 1) with the cache
> line size (e.g. 64 bytes on x86) and properly align it, or simply uses
> 4KB or even a larger value.
> 
> In case the reserved-size is too small, QEMU will complain and abort,
> so the user still has chance to know what goes wrong.
> 
> > 
> >  * Why is it called "reserved-size" instead of "flush-hints-size"?
> >  
> 
> This property is made as a property of pc-dimm rather than nvdimm,
> which could be used for other purposes, e.g. adjust the alignment the
> base address of hotplugged pc-dimm (I remember old linux kernels on
> x86-64 requires hotplugged memory chunk be 128MB aligned).
it would be rather awkward to use with pc-dimm:
 1: it would affect not the dimm for which it's specified but the following one
 2: to set it to correct value that would align base address of the next dimm
    to need value, the user first would have to know (set manually) a base address
    of dimm for which reserved-size is provided.

Users would be better off if he/she just provided properly aligned base address
instead of reserved-size.

> Of course,
> it can be limited to be a nvdimm-only property, and renamed to
> 'flush-hints-size' in that case.
pls move this property to nvdimm

> 
> Thanks,
> Haozhong

  reply	other threads:[~2017-04-20 10:54 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  8:41 [Qemu-devel] [RFC PATCH 0/4] nvdimm: enable flush hint address structure Haozhong Zhang
2017-03-31  8:41 ` [Qemu-devel] [RFC PATCH 1/4] pc-dimm: add 'reserved-size' to reserve address range after the ending address Haozhong Zhang
2017-04-06 10:24   ` Stefan Hajnoczi
2017-04-06 10:46     ` Haozhong Zhang
2017-04-07 13:46       ` Stefan Hajnoczi
2017-04-11  8:57         ` Haozhong Zhang
2017-04-20 10:54           ` Igor Mammedov [this message]
2017-04-06 11:50   ` Xiao Guangrong
2017-03-31  8:41 ` [Qemu-devel] [RFC PATCH 2/4] nvdimm: add functions to initialize and perform flush on back store Haozhong Zhang
2017-04-06 11:52   ` Xiao Guangrong
2017-04-11  8:22     ` Haozhong Zhang
2017-04-11  8:29       ` Haozhong Zhang
2017-04-11 11:55         ` Xiao Guangrong
2017-04-20 13:12   ` Igor Mammedov
2017-03-31  8:41 ` [Qemu-devel] [RFC PATCH 3/4] nvdimm acpi: record the cache line size in AcpiNVDIMMState Haozhong Zhang
2017-03-31  8:41 ` [Qemu-devel] [RFC PATCH 4/4] nvdimm acpi: build flush hint address structure if required Haozhong Zhang
2017-04-06 10:13   ` Stefan Hajnoczi
2017-04-06 10:53     ` Haozhong Zhang
2017-04-07 14:41       ` Stefan Hajnoczi
2017-04-07 15:51     ` Dan Williams
2017-04-06 10:25   ` Stefan Hajnoczi
2017-04-20 11:22   ` Igor Mammedov
2017-04-06  9:39 ` [Qemu-devel] [RFC PATCH 0/4] nvdimm: enable flush hint address structure Xiao Guangrong
2017-04-06  9:58   ` Haozhong Zhang
2017-04-06 11:46     ` Xiao Guangrong
2017-04-06  9:43 ` Stefan Hajnoczi
2017-04-06 10:31   ` Haozhong Zhang
2017-04-07 14:38     ` Stefan Hajnoczi
2017-04-06 12:02   ` Xiao Guangrong
2017-04-11  8:41     ` Haozhong Zhang
2017-04-11 14:56       ` Dan Williams
2017-04-20 19:49         ` Dan Williams
2017-04-21 13:56           ` Stefan Hajnoczi
2017-04-21 19:14             ` Dan Williams
2017-04-06 14:32   ` Dan Williams
2017-04-07 14:31     ` Stefan Hajnoczi
2017-04-11  6:34   ` Haozhong Zhang
2017-04-18 10:15     ` Stefan Hajnoczi

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=20170420125419.0c0bf21f@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=haozhong.zhang@intel.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=xiaoguangrong.eric@gmail.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 NNTP newsgroup(s).