From: Marcelo Tosatti <mtosatti@redhat.com>
To: Huang Ying <ying.huang@intel.com>, Anthony Liguori <aliguori@us.ibm.com>
Cc: Avi Kivity <avi@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Dean Nelson <dnelson@redhat.com>,
Andi Kleen <andi@firstfloor.org>
Subject: Re: [RFC 1/2] Add qemu_ram_remap
Date: Tue, 4 Jan 2011 18:35:14 -0200 [thread overview]
Message-ID: <20110104203514.GA3687@amt.cnet> (raw)
In-Reply-To: <1293772954.22308.250.camel@yhuang-dev>
On Fri, Dec 31, 2010 at 01:22:34PM +0800, Huang Ying wrote:
> qemu_ram_remap() unmaps the specified RAM pages, then re-maps these
> pages again. This is used by KVM HWPoison support to clear HWPoisoned
> page tables across guest rebooting, so that a new page may be
> allocated later to recover the memory error.
>
> Signed-off-by: Huang Ying <ying.huang@intel.com>
> ---
> cpu-all.h | 4 +++
> cpu-common.h | 1
> exec.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 65 insertions(+), 1 deletion(-)
>
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -861,10 +861,14 @@ target_phys_addr_t cpu_get_phys_page_deb
> extern int phys_ram_fd;
> extern ram_addr_t ram_size;
>
> +/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
> +#define RAM_PREALLOC_MASK (1 << 0)
> +
> typedef struct RAMBlock {
> uint8_t *host;
> ram_addr_t offset;
> ram_addr_t length;
> + uint32_t flags;
> char idstr[256];
> QLIST_ENTRY(RAMBlock) next;
> #if defined(__linux__) && !defined(TARGET_S390X)
> --- a/exec.c
> +++ b/exec.c
> @@ -2845,6 +2845,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(Devic
>
> if (host) {
> new_block->host = host;
> + new_block->flags |= RAM_PREALLOC_MASK;
> } else {
> if (mem_path) {
> #if defined (__linux__) && !defined(TARGET_S390X)
> @@ -2911,7 +2912,9 @@ void qemu_ram_free(ram_addr_t addr)
> QLIST_FOREACH(block, &ram_list.blocks, next) {
> if (addr == block->offset) {
> QLIST_REMOVE(block, next);
> - if (mem_path) {
> + if (block->flags & RAM_PREALLOC_MASK)
> + ;
Missing braces.
Otherwise looks fine to me.
Should be merged upstream QEMU... Anthony?
WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Huang Ying <ying.huang@intel.com>, Anthony Liguori <aliguori@us.ibm.com>
Cc: Dean Nelson <dnelson@redhat.com>,
Andi Kleen <andi@firstfloor.org>, Avi Kivity <avi@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [RFC 1/2] Add qemu_ram_remap
Date: Tue, 4 Jan 2011 18:35:14 -0200 [thread overview]
Message-ID: <20110104203514.GA3687@amt.cnet> (raw)
In-Reply-To: <1293772954.22308.250.camel@yhuang-dev>
On Fri, Dec 31, 2010 at 01:22:34PM +0800, Huang Ying wrote:
> qemu_ram_remap() unmaps the specified RAM pages, then re-maps these
> pages again. This is used by KVM HWPoison support to clear HWPoisoned
> page tables across guest rebooting, so that a new page may be
> allocated later to recover the memory error.
>
> Signed-off-by: Huang Ying <ying.huang@intel.com>
> ---
> cpu-all.h | 4 +++
> cpu-common.h | 1
> exec.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 65 insertions(+), 1 deletion(-)
>
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -861,10 +861,14 @@ target_phys_addr_t cpu_get_phys_page_deb
> extern int phys_ram_fd;
> extern ram_addr_t ram_size;
>
> +/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
> +#define RAM_PREALLOC_MASK (1 << 0)
> +
> typedef struct RAMBlock {
> uint8_t *host;
> ram_addr_t offset;
> ram_addr_t length;
> + uint32_t flags;
> char idstr[256];
> QLIST_ENTRY(RAMBlock) next;
> #if defined(__linux__) && !defined(TARGET_S390X)
> --- a/exec.c
> +++ b/exec.c
> @@ -2845,6 +2845,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(Devic
>
> if (host) {
> new_block->host = host;
> + new_block->flags |= RAM_PREALLOC_MASK;
> } else {
> if (mem_path) {
> #if defined (__linux__) && !defined(TARGET_S390X)
> @@ -2911,7 +2912,9 @@ void qemu_ram_free(ram_addr_t addr)
> QLIST_FOREACH(block, &ram_list.blocks, next) {
> if (addr == block->offset) {
> QLIST_REMOVE(block, next);
> - if (mem_path) {
> + if (block->flags & RAM_PREALLOC_MASK)
> + ;
Missing braces.
Otherwise looks fine to me.
Should be merged upstream QEMU... Anthony?
next prev parent reply other threads:[~2011-01-04 20:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-31 5:22 [RFC 1/2] Add qemu_ram_remap Huang Ying
2010-12-31 5:22 ` [Qemu-devel] " Huang Ying
2011-01-04 20:35 ` Marcelo Tosatti [this message]
2011-01-04 20:35 ` [Qemu-devel] " Marcelo Tosatti
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=20110104203514.GA3687@amt.cnet \
--to=mtosatti@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=andi@firstfloor.org \
--cc=avi@redhat.com \
--cc=dnelson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=ying.huang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.