All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiang Zheng <zhengxiang9@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Shannon Zhao <shannon.zhaosl@gmail.com>,
	Laszlo Ersek <lersek@redhat.com>,
	James Morse <james.morse@arm.com>,
	gengdongjiu <gengdongjiu@huawei.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	"xuwei (O)" <xuwei5@huawei.com>, kvm-devel <kvm@vger.kernel.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>, Linuxarm <linuxarm@huawei.com>,
	<wanghaibin.wang@huawei.com>
Subject: Re: [Qemu-arm] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h
Date: Tue, 8 Oct 2019 15:01:22 +0800	[thread overview]
Message-ID: <a857520c-f115-a096-3aeb-3d3588575c4a@huawei.com> (raw)
In-Reply-To: <CAFEAcA_o6NkOGptWFOoVt4pUgHU+dNyWQ9h_VfNweR17CtHSnw@mail.gmail.com>



On 2019/9/27 21:19, Peter Maydell wrote:
> On Fri, 6 Sep 2019 at 09:33, Xiang Zheng <zhengxiang9@huawei.com> wrote:
>>
>> From: Dongjiu Geng <gengdongjiu@huawei.com>
>>
>> kvm_hwpoison_page_add() and kvm_unpoison_all() will both be used by X86
>> and ARM platforms, so moving them into "include/sysemu/kvm_int.h" to
>> avoid duplicate code.
>>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
>> ---
>>  accel/kvm/kvm-all.c      | 33 +++++++++++++++++++++++++++++++++
>>  include/sysemu/kvm_int.h | 23 +++++++++++++++++++++++
>>  target/arm/kvm.c         |  3 +++
>>  target/i386/kvm.c        | 34 ----------------------------------
>>  4 files changed, 59 insertions(+), 34 deletions(-)
> 
>>  static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
>>  {
>>  #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
>> diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
>> index 72b2d1b3ae..3ad49f9a28 100644
>> --- a/include/sysemu/kvm_int.h
>> +++ b/include/sysemu/kvm_int.h
>> @@ -41,4 +41,27 @@ typedef struct KVMMemoryListener {
>>  void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
>>                                    AddressSpace *as, int as_id);
>>
>> +/**
>> + * kvm_hwpoison_page_add:
>> + *
>> + * Parameters:
>> + *  @ram_addr: the address in the RAM for the poisoned page
>> + *
>> + * Add a poisoned page to the list
>> + *
>> + * Return: None.
>> + */
>> +void kvm_hwpoison_page_add(ram_addr_t ram_addr);
>> +
>> +/**
>> + * kvm_unpoison_all:
>> + *
>> + * Parameters:
>> + *  @param: some data may be passed to this function
>> + *
>> + * Free and remove all the poisoned pages in the list
>> + *
>> + * Return: None.
>> + */
>> +void kvm_unpoison_all(void *param);
>>  #endif
>> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
>> index b2eaa50b8d..3a110be7b8 100644
>> --- a/target/arm/kvm.c
>> +++ b/target/arm/kvm.c
>> @@ -20,6 +20,7 @@
>>  #include "sysemu/sysemu.h"
>>  #include "sysemu/kvm.h"
>>  #include "sysemu/kvm_int.h"
>> +#include "sysemu/reset.h"
>>  #include "kvm_arm.h"
>>  #include "cpu.h"
>>  #include "trace.h"
>> @@ -195,6 +196,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>>
>>      cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>>
>> +    qemu_register_reset(kvm_unpoison_all, NULL);
>> +
> 
> Rather than registering the same reset handler in
> all the architectures, we could register it in the
> generic kvm_init() function. (For architectures that
> don't use the poison-list functionality the reset handler
> will harmlessly do nothing, because there will be nothing
> in the list.)
> 
> This would allow you to not have to make the
> kvm_unpoison_all() function global -- it can be static
> in accel/tcg/kvm-all.c.

OK, I will move the register code into the kvm_init() function.

> 
>>      return 0;
>>  }
> 
> thanks
> -- PMM
> 
> .
> 

-- 

Thanks,
Xiang


WARNING: multiple messages have this Message-ID (diff)
From: Xiang Zheng <zhengxiang9@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	kvm-devel <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	wanghaibin.wang@huawei.com, Marcelo Tosatti <mtosatti@redhat.com>,
	Linuxarm <linuxarm@huawei.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	gengdongjiu <gengdongjiu@huawei.com>,
	Shannon Zhao <shannon.zhaosl@gmail.com>,
	qemu-arm <qemu-arm@nongnu.org>, James Morse <james.morse@arm.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"xuwei \(O\)" <xuwei5@huawei.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-arm] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h
Date: Tue, 8 Oct 2019 15:01:22 +0800	[thread overview]
Message-ID: <a857520c-f115-a096-3aeb-3d3588575c4a@huawei.com> (raw)
In-Reply-To: <CAFEAcA_o6NkOGptWFOoVt4pUgHU+dNyWQ9h_VfNweR17CtHSnw@mail.gmail.com>



On 2019/9/27 21:19, Peter Maydell wrote:
> On Fri, 6 Sep 2019 at 09:33, Xiang Zheng <zhengxiang9@huawei.com> wrote:
>>
>> From: Dongjiu Geng <gengdongjiu@huawei.com>
>>
>> kvm_hwpoison_page_add() and kvm_unpoison_all() will both be used by X86
>> and ARM platforms, so moving them into "include/sysemu/kvm_int.h" to
>> avoid duplicate code.
>>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
>> ---
>>  accel/kvm/kvm-all.c      | 33 +++++++++++++++++++++++++++++++++
>>  include/sysemu/kvm_int.h | 23 +++++++++++++++++++++++
>>  target/arm/kvm.c         |  3 +++
>>  target/i386/kvm.c        | 34 ----------------------------------
>>  4 files changed, 59 insertions(+), 34 deletions(-)
> 
>>  static uint32_t adjust_ioeventfd_endianness(uint32_t val, uint32_t size)
>>  {
>>  #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
>> diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
>> index 72b2d1b3ae..3ad49f9a28 100644
>> --- a/include/sysemu/kvm_int.h
>> +++ b/include/sysemu/kvm_int.h
>> @@ -41,4 +41,27 @@ typedef struct KVMMemoryListener {
>>  void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
>>                                    AddressSpace *as, int as_id);
>>
>> +/**
>> + * kvm_hwpoison_page_add:
>> + *
>> + * Parameters:
>> + *  @ram_addr: the address in the RAM for the poisoned page
>> + *
>> + * Add a poisoned page to the list
>> + *
>> + * Return: None.
>> + */
>> +void kvm_hwpoison_page_add(ram_addr_t ram_addr);
>> +
>> +/**
>> + * kvm_unpoison_all:
>> + *
>> + * Parameters:
>> + *  @param: some data may be passed to this function
>> + *
>> + * Free and remove all the poisoned pages in the list
>> + *
>> + * Return: None.
>> + */
>> +void kvm_unpoison_all(void *param);
>>  #endif
>> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
>> index b2eaa50b8d..3a110be7b8 100644
>> --- a/target/arm/kvm.c
>> +++ b/target/arm/kvm.c
>> @@ -20,6 +20,7 @@
>>  #include "sysemu/sysemu.h"
>>  #include "sysemu/kvm.h"
>>  #include "sysemu/kvm_int.h"
>> +#include "sysemu/reset.h"
>>  #include "kvm_arm.h"
>>  #include "cpu.h"
>>  #include "trace.h"
>> @@ -195,6 +196,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>>
>>      cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>>
>> +    qemu_register_reset(kvm_unpoison_all, NULL);
>> +
> 
> Rather than registering the same reset handler in
> all the architectures, we could register it in the
> generic kvm_init() function. (For architectures that
> don't use the poison-list functionality the reset handler
> will harmlessly do nothing, because there will be nothing
> in the list.)
> 
> This would allow you to not have to make the
> kvm_unpoison_all() function global -- it can be static
> in accel/tcg/kvm-all.c.

OK, I will move the register code into the kvm_init() function.

> 
>>      return 0;
>>  }
> 
> thanks
> -- PMM
> 
> .
> 

-- 

Thanks,
Xiang



  reply	other threads:[~2019-10-08  7:01 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  8:31 [PATCH v18 0/6] Add ARMv8 RAS virtualization support in QEMU Xiang Zheng
2019-09-06  8:31 ` [Qemu-devel] " Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 1/6] hw/arm/virt: Introduce RAS platform version and RAS machine option Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-27 14:02   ` Peter Maydell
2019-09-27 14:02     ` Peter Maydell
2019-09-29  2:04     ` Xiang Zheng
2019-09-29  2:04       ` Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 2/6] docs: APEI GHES generation and CPER record description Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-19 13:25   ` Peter Maydell
2019-09-19 13:25     ` [Qemu-devel] " Peter Maydell
2019-09-20  1:45     ` Xiang Zheng
2019-09-20  1:45       ` Xiang Zheng
2019-10-04  8:20   ` [Qemu-devel] " Igor Mammedov
2019-10-04  8:20     ` Igor Mammedov
2019-10-08 13:25     ` Xiang Zheng
2019-10-08 13:25       ` Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 3/6] ACPI: Add APEI GHES table generation support Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-27 15:43   ` Michael S. Tsirkin
2019-09-27 15:43     ` Michael S. Tsirkin
2019-10-08  6:00     ` Xiang Zheng
2019-10-08  6:00       ` Xiang Zheng
2019-10-08  7:45       ` Michael S. Tsirkin
2019-10-08  7:45         ` Michael S. Tsirkin
2019-10-08 12:48         ` Xiang Zheng
2019-10-08 12:48           ` Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-27 13:19   ` [Qemu-arm] " Peter Maydell
2019-09-27 13:19     ` Peter Maydell
2019-10-08  7:01     ` Xiang Zheng [this message]
2019-10-08  7:01       ` Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 5/6] target-arm: kvm64: inject synchronous External Abort Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-27 13:33   ` Peter Maydell
2019-09-27 13:33     ` Peter Maydell
2019-10-08  8:05     ` Xiang Zheng
2019-10-08  8:05       ` Xiang Zheng
2019-09-06  8:31 ` [PATCH v18 6/6] target-arm: kvm64: handle SIGBUS signal from kernel or KVM Xiang Zheng
2019-09-06  8:31   ` [Qemu-devel] " Xiang Zheng
2019-09-27 13:57   ` Peter Maydell
2019-09-27 13:57     ` Peter Maydell
2019-10-08 12:42     ` Xiang Zheng
2019-10-08 12:42       ` Xiang Zheng
2019-09-17 12:39 ` [PATCH v18 0/6] Add ARMv8 RAS virtualization support in QEMU Xiang Zheng
2019-09-17 12:39   ` [Qemu-devel] " Xiang Zheng
2019-09-20  2:07   ` gengdongjiu
2019-09-20  2:07     ` gengdongjiu
2019-09-27 14:03 ` [Qemu-arm] " Peter Maydell
2019-09-27 14:03   ` Peter Maydell

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=a857520c-f115-a096-3aeb-3d3588575c4a@huawei.com \
    --to=zhengxiang9@huawei.com \
    --cc=ehabkost@redhat.com \
    --cc=gengdongjiu@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=james.morse@arm.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=lersek@redhat.com \
    --cc=linuxarm@huawei.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=shannon.zhaosl@gmail.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=xuwei5@huawei.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.