Skip to contentSkip to conversation

comments on: get page size in device init

Qemu-devel Michael S. Tsirkin 3 participants 9 messages Sep 23, 2009

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines

Compile msix only once

Get page size in device init.

What was the motivation for the page size change? It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Did I miss this patch on qemu-devel? Generally, it's nice to have patches posted to list to give people a chance to comment, before they are pushed to the public tree. Right?

Finally, the 2 changes seem unrelated: why was it a good idea to bundle them in one commit?

Thanks,

Signature · 1 line
MST
#1 lore raw
Quoted 7 lines · Michael S. Tsirkin
Quoted 5 lines

    Compile msix only once

    Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 3 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

Moreover, devices in general (with the exception of maybe virtio and Xen devices and horrible abominations like vmmouse/vmport) should have no knowledge about the CPU. TARGET_PAGE_SIZE is a parameter of the CPU, no device should need to use it. Therefore this commit is actually a cleanup.

Quoted 3 lines

Did I miss this patch on qemu-devel?  Generally, it's nice to have patches posted to list to give people a chance to comment, before they are pushed to the public tree.  Right?

No, you did not miss anything. I was not nice, sorry about that.

Quoted 2 lines

Finally, the 2 changes seem unrelated: why was it a good idea to bundle them in one commit?

Which 2 changes are you referring to? I think all changes are necessary.

#2 lore raw
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

Compile msix only once

Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

We could probably get away with doing

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Regards,

Anthony Liguori

#3 lore raw
Quoted 24 lines · Anthony Liguori
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

Compile msix only once

Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

Quoted 6 lines

We could probably get away with doing

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Sounds good.

Quoted 3 lines

Regards,

Anthony Liguori

#4 lore raw
Quoted 27 lines · Michael S. Tsirkin
Quoted 26 lines · Anthony Liguori
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

    Compile msix only once

    Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

We could probably get away with doing

Quoted 7 lines
Quoted 4 lines

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Sounds good.

That would work and target_get_page_size() together with get_ram_size() would also handle the virtio case nicely, except for the if (!kvm_enabled() || kvm_has_sync_mmu()) part.

#5 lore raw
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Michael S. Tsirkin
Quoted 30 lines · Anthony Liguori
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

    Compile msix only once

    Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

We could probably get away with doing

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Quoted 5 lines
Quoted 1 line

Sounds good.

That would work and target_get_page_size() together with get_ram_size() would also handle the virtio case nicely, except for the if (!kvm_enabled() || kvm_has_sync_mmu()) part.

Where's get_ram_size needed?

Signature · 1 line
MST
#6 lore raw
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Michael S. Tsirkin
Quoted 30 lines · Anthony Liguori
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

    Compile msix only once

    Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

We could probably get away with doing

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sounds good.

That would work and target_get_page_size() together with get_ram_size() would also handle the virtio case nicely, except for the if (!kvm_enabled() || kvm_has_sync_mmu()) part.

Where's get_ram_size needed?

In virtio-balloon.

#7 lore raw
In reply to Blue Swirl
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Michael S. Tsirkin
Quoted 30 lines · Anthony Liguori
Quoted 14 lines · Blue Swirl
Quoted 8 lines · Michael S. Tsirkin
Quoted 6 lines

    Compile msix only once

    Get page size in device init.

What was the motivation for the page size change?

"Compile msix only once"

Quoted 8 lines
Quoted 4 lines

It seems the only user passes TARGET_PAGE_SIZE anyway, using a constant seems clearer and probably generates less code. No?

Yes, but then the code would depend on TARGET_PAGE_SIZE, making it impossible to compile the code only once.

We could probably get away with doing

#define TARGET_PAGE_SIZE target_get_page_size()

And take care of a big chunk of this without passing page size parameters around.

Quoted 5 lines
Quoted 1 line

Sounds good.

That would work and target_get_page_size() together with get_ram_size() would also handle the virtio case nicely, except for the if (!kvm_enabled() || kvm_has_sync_mmu()) part.

OK, I did and just sent the msix part, virtio can come on top.

Signature · 1 line
MST
#8 lore raw
In reply to Blue Swirl
Quoted 4 lines · Blue Swirl

That would work and target_get_page_size() together with get_ram_size() would also handle the virtio case nicely, except for the if (!kvm_enabled() || kvm_has_sync_mmu()) part.

We probably want to introduce a qemu_zero_memory_page() that includes that check. We have the same basic check during memory loading too.

Regards,

Anthony Liguori