All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>, David Hildenbrand <david@redhat.com>
Cc: kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>
Subject: Re: [PATCH kvm-unit-tests v2 07/11] s390x: initialize the physical allocator
Date: Mon, 15 Jan 2018 11:38:30 +0100	[thread overview]
Message-ID: <804f02f7-61ee-e443-e750-31cb9af00c70@redhat.com> (raw)
In-Reply-To: <20180115101614.7zazuegmbmu3p6ku@kamzik.brq.redhat.com>

On 15/01/2018 11:16, Andrew Jones wrote:
> state 2: phys-alloc is set up by the phys_alloc_init() call
>
> state 3: alloc_page() is set up, need call that allocates chunk with the
>                                  phys-allocator for free_pages()
> 
> (Instead of a chunk, all memory could be given, but then either a
>  new set of early-ops should be provided that are based on
>  alloc_page(), or all early memory allocations must use alloc_page())
> 
> state 4: virtual memory is set up by the setup_vm() call
> 
> Or, simply remove state 2 and its code and alloc-ops, changing all early
> allocations to use alloc_page(). If each arch provides an mmu_enabled()
> call, then the alloc_ops->memalign call in memalign could be replaced
> with
> 
>  if (mmu_enabled())
>     vm_memalign(...)
>  else
>     /* fallback to alloc_pages() */
> 
> I probably should have written all this in a separate thread, because
> I wouldn't want to hold this series up on a rework of the general
> memory management framework. But, anyway, thoughts on that? Paolo?

State 3 should only exist in setup_mmu, so indeed the commit message
here is not accurate.  setup_vm does the transition from phys_alloc to
page_alloc before calling setup_mmu, exactly because setup_mmu already
needs to allocate pages:

        phys_alloc_get_unused(&base, &top);
        base = (base + PAGE_SIZE - 1) & -PAGE_SIZE;
        top = top & -PAGE_SIZE;
        free_pages(phys_to_virt(base), top - base);
        page_root = setup_mmu(top);
        alloc_ops = &vmalloc_ops;

The reason for state 2 to exist is that right now on x86 it is optional
to use the MMU.  You could use page-granularity allocation, but that
would be a waste of memory if we switch to a GTest-like API that needs
to dynamically allocate memory.

However, maybe it would make sense to make it internal just like state
3.  That would mean enabling the MMU directly where we now call
phys_alloc_init.  This is independent of course of this s390 series.

Paolo

  parent reply	other threads:[~2018-01-15 10:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 14:34 [PATCH kvm-unit-tests v2 00/11] s390x: vmalloc support David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 01/11] s390x: fix TEST BLOCK tests David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 02/11] s390x: use highest addresses for PGM_ADDRESSING errors David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 03/11] s390x: set initital stack pointer to stackptr, not stacktop David Hildenbrand
2018-01-12 16:04   ` Thomas Huth
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 04/11] s390x: add missing sclp definitions from QEMU David Hildenbrand
2018-01-15 10:46   ` Thomas Huth
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 05/11] s390x: rename sclp_setup() to sclp_ascii_setup() David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 06/11] s390x: detect installed memory David Hildenbrand
2018-01-15 10:56   ` Thomas Huth
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 07/11] s390x: initialize the physical allocator David Hildenbrand
2018-01-15 10:16   ` Andrew Jones
2018-01-15 10:21     ` David Hildenbrand
2018-01-15 10:31       ` Paolo Bonzini
2018-01-15 10:35         ` David Hildenbrand
2018-01-15 10:38     ` Paolo Bonzini [this message]
2018-01-15 10:50       ` Andrew Jones
2018-01-15 10:42     ` David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 08/11] s390x: add vmalloc support David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 09/11] s390x: enable DAT in PGM interrupt handler David Hildenbrand
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 10/11] s390x: add test for (v)malloc David Hildenbrand
2018-01-15 10:58   ` Thomas Huth
2018-01-12 14:34 ` [PATCH kvm-unit-tests v2 11/11] s390x: add sieve test David Hildenbrand

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=804f02f7-61ee-e443-e750-31cb9af00c70@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@redhat.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.