Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-03-02 Thread Hu Tao
On Tue, Feb 25, 2014 at 06:09:20PM +0800, Hu Tao wrote: > On Wed, Feb 19, 2014 at 10:03:13AM +0100, Paolo Bonzini wrote: > > <...> > > > > static int > > > ram_backend_memory_init(HostMemoryBackend *backend, Error **errp) > > > { > > >+HostMemoryBackendRam *ram_backend = MEMORY_BACKEND_RAM(ba

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 15:25, Igor Mammedov ha scritto: 1: 'realize' approach I suggested drawback is: assumption that all backends derived from HostMemoryBackend will inherit NUMA controls even if backend shouldn't have one (for example: fictional remote memor

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 14:47:28 +0100 Paolo Bonzini wrote: > Il 26/02/2014 14:43, Igor Mammedov ha scritto: > > On Wed, 26 Feb 2014 13:45:38 +0100 > > Paolo Bonzini wrote: > > > >> Il 26/02/2014 13:31, Igor Mammedov ha scritto: > > The problem is that some backends might not be handled the same

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 14:43, Igor Mammedov ha scritto: On Wed, 26 Feb 2014 13:45:38 +0100 Paolo Bonzini wrote: Il 26/02/2014 13:31, Igor Mammedov ha scritto: The problem is that some backends might not be handled the same way. For example, not all backends might produce a single void*/size_t pair for

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 13:45:38 +0100 Paolo Bonzini wrote: > Il 26/02/2014 13:31, Igor Mammedov ha scritto: > >> > The problem is that some backends might not be handled the same way. > >> > For example, not all backends might produce a single void*/size_t pair > >> > for the entire region. Think o

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 13:58, Marcelo Tosatti ha scritto: I'd prefer to keep backends simple, with 1:1 mapping to memory regions. I agree. However not all backends may have a mapping to a RAM memory region. A composite backend could create a container memory region whose children are other HostMemoryB

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Marcelo Tosatti
On Wed, Feb 26, 2014 at 01:45:38PM +0100, Paolo Bonzini wrote: > Il 26/02/2014 13:31, Igor Mammedov ha scritto: > >>> The problem is that some backends might not be handled the same way. > >>> For example, not all backends might produce a single void*/size_t pair > >>> for the entire region. Think

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 13:31, Igor Mammedov ha scritto: > The problem is that some backends might not be handled the same way. > For example, not all backends might produce a single void*/size_t pair > for the entire region. Think of a "composite" backend that produces a > large memory region from two sm

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 11:33:30 +0100 Paolo Bonzini wrote: > Il 26/02/2014 10:10, Igor Mammedov ha scritto: > > if we assume that NUMA policies apply to every hostmem derived backend, > > then we could realize() approach used by DEVICE. i.e. > > set NUMA policies in hostmem.c:hostmemory_backend_memo

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 16:59:44 +0800 Hu Tao wrote: > On Wed, Feb 26, 2014 at 09:47:08AM +0100, Igor Mammedov wrote: > > On Wed, 26 Feb 2014 13:00:03 +0800 > > Hu Tao wrote: > > > > > On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote: > > > > Il 25/02/2014 11:20, Hu Tao ha scritto: > >

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 09:47, Igor Mammedov ha scritto: I'm sorry that I've forgotten to mention prerequisite path https://github.com/imammedo/qemu/commit/72a079b88e055fc690c8895a99ccbcce36f6fc1f in stage tree https://github.com/imammedo/qemu/commits/memory-hotplug-v8 Thanks, I'll add this patch to the

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 10:10, Igor Mammedov ha scritto: if we assume that NUMA policies apply to every hostmem derived backend, then we could realize() approach used by DEVICE. i.e. set NUMA policies in hostmem.c:hostmemory_backend_memory_init() Add parent_complete field to ram-backend class and store th

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Hu Tao
On Wed, Feb 26, 2014 at 09:47:08AM +0100, Igor Mammedov wrote: > On Wed, 26 Feb 2014 13:00:03 +0800 > Hu Tao wrote: > > > On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote: > > > Il 25/02/2014 11:20, Hu Tao ha scritto: > > > >There is a problem that user_creatable_complete() is called

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 13:57:06 +0800 Hu Tao wrote: > On Wed, Feb 19, 2014 at 10:36:57AM +0100, Igor Mammedov wrote: > > On Wed, 19 Feb 2014 10:03:13 +0100 > > Paolo Bonzini wrote: > > > > > 19/02/2014 08:54, Hu Tao ha scritto: > > > > Thus makes user control how to allocate memory for ram backe

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Paolo Bonzini
Il 26/02/2014 06:57, Hu Tao ha scritto: If lines about memory polices are moved up to hostmem.c, the only thing left in ram_backend_memory_init() is calling memory_region_init_ram() to allocate memory. Then it comes a problem that when to apply memory polices? Choices: 1. apply memory polices in

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-26 Thread Igor Mammedov
On Wed, 26 Feb 2014 13:00:03 +0800 Hu Tao wrote: > On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote: > > Il 25/02/2014 11:20, Hu Tao ha scritto: > > >There is a problem that user_creatable_complete() is called before > > >adding object to "/objects" (see object_create()), which trigg

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-25 Thread Hu Tao
On Wed, Feb 19, 2014 at 10:36:57AM +0100, Igor Mammedov wrote: > On Wed, 19 Feb 2014 10:03:13 +0100 > Paolo Bonzini wrote: > > > 19/02/2014 08:54, Hu Tao ha scritto: > > > Thus makes user control how to allocate memory for ram backend. > > > > > > Signed-off-by: Hu Tao > > > --- > > > backend

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-25 Thread Hu Tao
On Tue, Feb 25, 2014 at 03:15:53PM +0100, Paolo Bonzini wrote: > Il 25/02/2014 11:20, Hu Tao ha scritto: > >There is a problem that user_creatable_complete() is called before > >adding object to "/objects" (see object_create()), which triggers a > >assert failure when calling object_get_canonical_p

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-25 Thread Paolo Bonzini
Il 25/02/2014 11:20, Hu Tao ha scritto: There is a problem that user_creatable_complete() is called before adding object to "/objects" (see object_create()), which triggers a assert failure when calling object_get_canonical_path() in ram_backend_memory_init(). Any ideas? You can call object_pro

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-25 Thread Hu Tao
On Wed, Feb 19, 2014 at 10:36:57AM +0100, Igor Mammedov wrote: > On Wed, 19 Feb 2014 10:03:13 +0100 > Paolo Bonzini wrote: > > > 19/02/2014 08:54, Hu Tao ha scritto: > > > Thus makes user control how to allocate memory for ram backend. > > > > > > Signed-off-by: Hu Tao > > > --- > > > backend

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-25 Thread Hu Tao
On Wed, Feb 19, 2014 at 10:03:13AM +0100, Paolo Bonzini wrote: <...> > > static int > > ram_backend_memory_init(HostMemoryBackend *backend, Error **errp) > > { > >+HostMemoryBackendRam *ram_backend = MEMORY_BACKEND_RAM(backend); > >+int mode = ram_backend->policy; > >+void *p; > >+

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-19 Thread Igor Mammedov
On Wed, 19 Feb 2014 10:03:13 +0100 Paolo Bonzini wrote: > 19/02/2014 08:54, Hu Tao ha scritto: > > Thus makes user control how to allocate memory for ram backend. > > > > Signed-off-by: Hu Tao > > --- > > backends/hostmem-ram.c | 158 > > > >

Re: [Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-19 Thread Paolo Bonzini
19/02/2014 08:54, Hu Tao ha scritto: Thus makes user control how to allocate memory for ram backend. Signed-off-by: Hu Tao --- backends/hostmem-ram.c | 158 include/sysemu/sysemu.h | 2 + 2 files changed, 160 insertions(+) diff --git a/back

[Qemu-devel] [PATCH v18 13/14] memory backend: fill memory backend ram fields

2014-02-18 Thread Hu Tao
Thus makes user control how to allocate memory for ram backend. Signed-off-by: Hu Tao --- backends/hostmem-ram.c | 158 include/sysemu/sysemu.h | 2 + 2 files changed, 160 insertions(+) diff --git a/backends/hostmem-ram.c b/backends/hostmem-ra