* [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
@ 2012-03-06 15:50 Avi Kivity
2012-03-06 16:01 ` Jan Kiszka
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Avi Kivity @ 2012-03-06 15:50 UTC (permalink / raw)
To: qemu-devel, Anthony Liguori; +Cc: Jan Kiszka
The kvmvapic code remaps a section of ROM as RAM to allow the guest to
maintain state there. It is careful to align the section size to a page
boundary, to avoid creating subpages, but neglects to do the same for
the start address. These leads to an assert later on when the memory
core tries to create a page which is half RAM and half ROM.
Fix by aligning the start address to a page boundary.
This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/kvmvapic.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
index 36ccfbc..e8bfeec 100644
--- a/hw/kvmvapic.c
+++ b/hw/kvmvapic.c
@@ -578,8 +578,10 @@ static void vapic_map_rom_writable(VAPICROMState *s)
rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
s->rom_size = rom_size;
- /* We need to round up to avoid creating subpages
+ /* We need to round to avoid creating subpages
* from which we cannot run code. */
+ rom_size += rom_paddr & ~TARGET_PAGE_MASK;
+ rom_paddr &= TARGET_PAGE_MASK;
rom_size = TARGET_PAGE_ALIGN(rom_size);
memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,
--
1.7.9
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
2012-03-06 15:50 [Qemu-devel] [PATCH] kvmvapic: align start address as well as size Avi Kivity
@ 2012-03-06 16:01 ` Jan Kiszka
2012-03-14 20:33 ` Anthony Liguori
2012-03-14 21:18 ` Anthony Liguori
2 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2012-03-06 16:01 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel@nongnu.org, Anthony Liguori
On 2012-03-06 16:50, Avi Kivity wrote:
> The kvmvapic code remaps a section of ROM as RAM to allow the guest to
> maintain state there. It is careful to align the section size to a page
> boundary, to avoid creating subpages, but neglects to do the same for
> the start address. These leads to an assert later on when the memory
> core tries to create a page which is half RAM and half ROM.
>
> Fix by aligning the start address to a page boundary.
>
> This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> hw/kvmvapic.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
> index 36ccfbc..e8bfeec 100644
> --- a/hw/kvmvapic.c
> +++ b/hw/kvmvapic.c
> @@ -578,8 +578,10 @@ static void vapic_map_rom_writable(VAPICROMState *s)
> rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
> s->rom_size = rom_size;
>
> - /* We need to round up to avoid creating subpages
> + /* We need to round to avoid creating subpages
> * from which we cannot run code. */
> + rom_size += rom_paddr & ~TARGET_PAGE_MASK;
> + rom_paddr &= TARGET_PAGE_MASK;
> rom_size = TARGET_PAGE_ALIGN(rom_size);
>
> memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
2012-03-06 15:50 [Qemu-devel] [PATCH] kvmvapic: align start address as well as size Avi Kivity
2012-03-06 16:01 ` Jan Kiszka
@ 2012-03-14 20:33 ` Anthony Liguori
2012-03-15 9:55 ` Avi Kivity
2012-03-14 21:18 ` Anthony Liguori
2 siblings, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2012-03-14 20:33 UTC (permalink / raw)
To: Avi Kivity; +Cc: Jan Kiszka, qemu-devel
On 03/06/2012 09:50 AM, Avi Kivity wrote:
> The kvmvapic code remaps a section of ROM as RAM to allow the guest to
> maintain state there. It is careful to align the section size to a page
> boundary, to avoid creating subpages, but neglects to do the same for
> the start address. These leads to an assert later on when the memory
> core tries to create a page which is half RAM and half ROM.
>
> Fix by aligning the start address to a page boundary.
>
> This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
Tested-by: Anthony Liguori <aliguori@us.ibm.com>
Are you going to do a PULL request or do you want me to apply directly?
Regards,
Anthony Liguori
> ---
> hw/kvmvapic.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
> index 36ccfbc..e8bfeec 100644
> --- a/hw/kvmvapic.c
> +++ b/hw/kvmvapic.c
> @@ -578,8 +578,10 @@ static void vapic_map_rom_writable(VAPICROMState *s)
> rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
> s->rom_size = rom_size;
>
> - /* We need to round up to avoid creating subpages
> + /* We need to round to avoid creating subpages
> * from which we cannot run code. */
> + rom_size += rom_paddr& ~TARGET_PAGE_MASK;
> + rom_paddr&= TARGET_PAGE_MASK;
> rom_size = TARGET_PAGE_ALIGN(rom_size);
>
> memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
2012-03-06 15:50 [Qemu-devel] [PATCH] kvmvapic: align start address as well as size Avi Kivity
2012-03-06 16:01 ` Jan Kiszka
2012-03-14 20:33 ` Anthony Liguori
@ 2012-03-14 21:18 ` Anthony Liguori
2 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2012-03-14 21:18 UTC (permalink / raw)
To: Avi Kivity; +Cc: Jan Kiszka, qemu-devel
On 03/06/2012 09:50 AM, Avi Kivity wrote:
> The kvmvapic code remaps a section of ROM as RAM to allow the guest to
> maintain state there. It is careful to align the section size to a page
> boundary, to avoid creating subpages, but neglects to do the same for
> the start address. These leads to an assert later on when the memory
> core tries to create a page which is half RAM and half ROM.
>
> Fix by aligning the start address to a page boundary.
>
> This can be triggered by running qemu-system-x86_64 -enable-kvm -vga none.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> hw/kvmvapic.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c
> index 36ccfbc..e8bfeec 100644
> --- a/hw/kvmvapic.c
> +++ b/hw/kvmvapic.c
> @@ -578,8 +578,10 @@ static void vapic_map_rom_writable(VAPICROMState *s)
> rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
> s->rom_size = rom_size;
>
> - /* We need to round up to avoid creating subpages
> + /* We need to round to avoid creating subpages
> * from which we cannot run code. */
> + rom_size += rom_paddr& ~TARGET_PAGE_MASK;
> + rom_paddr&= TARGET_PAGE_MASK;
> rom_size = TARGET_PAGE_ALIGN(rom_size);
>
> memory_region_init_alias(&s->rom, "kvmvapic-rom", section.mr, rom_paddr,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
2012-03-14 20:33 ` Anthony Liguori
@ 2012-03-15 9:55 ` Avi Kivity
2012-03-15 13:16 ` Anthony Liguori
0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2012-03-15 9:55 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Jan Kiszka, qemu-devel
On 03/14/2012 10:33 PM, Anthony Liguori wrote:
> On 03/06/2012 09:50 AM, Avi Kivity wrote:
>> The kvmvapic code remaps a section of ROM as RAM to allow the guest to
>> maintain state there. It is careful to align the section size to a page
>> boundary, to avoid creating subpages, but neglects to do the same for
>> the start address. These leads to an assert later on when the memory
>> core tries to create a page which is half RAM and half ROM.
>>
>> Fix by aligning the start address to a page boundary.
>>
>> This can be triggered by running qemu-system-x86_64 -enable-kvm -vga
>> none.
>>
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>
> Tested-by: Anthony Liguori <aliguori@us.ibm.com>
>
> Are you going to do a PULL request or do you want me to apply directly?
I forgot all about it, sorry.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] kvmvapic: align start address as well as size
2012-03-15 9:55 ` Avi Kivity
@ 2012-03-15 13:16 ` Anthony Liguori
0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2012-03-15 13:16 UTC (permalink / raw)
To: Avi Kivity; +Cc: Jan Kiszka, qemu-devel
On 03/15/2012 04:55 AM, Avi Kivity wrote:
> On 03/14/2012 10:33 PM, Anthony Liguori wrote:
>> On 03/06/2012 09:50 AM, Avi Kivity wrote:
>>> The kvmvapic code remaps a section of ROM as RAM to allow the guest to
>>> maintain state there. It is careful to align the section size to a page
>>> boundary, to avoid creating subpages, but neglects to do the same for
>>> the start address. These leads to an assert later on when the memory
>>> core tries to create a page which is half RAM and half ROM.
>>>
>>> Fix by aligning the start address to a page boundary.
>>>
>>> This can be triggered by running qemu-system-x86_64 -enable-kvm -vga
>>> none.
>>>
>>> Signed-off-by: Avi Kivity<avi@redhat.com>
>>
>> Tested-by: Anthony Liguori<aliguori@us.ibm.com>
>>
>> Are you going to do a PULL request or do you want me to apply directly?
>
> I forgot all about it, sorry.
No worries. I actually caught the bug in the original pull request but do to a
bug in qemu-test, when I tried to bisect, things got weird and I mistakenly
thought the real problem had been introduced earlier.
Regards,
Anthony Liguori
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-15 13:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-06 15:50 [Qemu-devel] [PATCH] kvmvapic: align start address as well as size Avi Kivity
2012-03-06 16:01 ` Jan Kiszka
2012-03-14 20:33 ` Anthony Liguori
2012-03-15 9:55 ` Avi Kivity
2012-03-15 13:16 ` Anthony Liguori
2012-03-14 21:18 ` Anthony Liguori
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).