qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: berrange@redhat.com, i@maskray.me, philmd@redhat.com
Subject: Re: [PATCH 2/7] tcg: Remove softmmu code_gen_buffer fixed address
Date: Wed, 18 Dec 2019 08:01:12 +0100	[thread overview]
Message-ID: <b50b200c-beee-6c8b-d8f9-994555427576@redhat.com> (raw)
In-Reply-To: <20191218031920.6414-3-richard.henderson@linaro.org>

On 18/12/2019 04.19, Richard Henderson wrote:
> The commentary talks about "in concert with the addresses
> assigned in the relevant linker script", except there is no
> linker script for softmmu, nor has there been for some time.
> 
> (Do not confuse the user-only linker script editing that was
> removed in the previous patch, because user-only does not
> use this code_gen_buffer allocation method.)
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  accel/tcg/translate-all.c | 37 +++++--------------------------------
>  1 file changed, 5 insertions(+), 32 deletions(-)
> 
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 9f48da9472..88468a1c08 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -1032,47 +1032,20 @@ static inline void *alloc_code_gen_buffer(void)
>  {
>      int prot = PROT_WRITE | PROT_READ | PROT_EXEC;
>      int flags = MAP_PRIVATE | MAP_ANONYMOUS;
> -    uintptr_t start = 0;
>      size_t size = tcg_ctx->code_gen_buffer_size;
>      void *buf;
>  
> -    /* Constrain the position of the buffer based on the host cpu.
> -       Note that these addresses are chosen in concert with the
> -       addresses assigned in the relevant linker script file.  */
> -# if defined(__PIE__) || defined(__PIC__)
> -    /* Don't bother setting a preferred location if we're building
> -       a position-independent executable.  We're more likely to get
> -       an address near the main executable if we let the kernel
> -       choose the address.  */
> -# elif defined(__x86_64__) && defined(MAP_32BIT)
> -    /* Force the memory down into low memory with the executable.
> -       Leave the choice of exact location with the kernel.  */
> -    flags |= MAP_32BIT;
> -    /* Cannot expect to map more than 800MB in low memory.  */
> -    if (size > 800u * 1024 * 1024) {
> -        tcg_ctx->code_gen_buffer_size = size = 800u * 1024 * 1024;
> -    }
> -# elif defined(__sparc__)
> -    start = 0x40000000ul;
> -# elif defined(__s390x__)
> -    start = 0x90000000ul;
> -# elif defined(__mips__)
> -#  if _MIPS_SIM == _ABI64
> -    start = 0x128000000ul;
> -#  else
> -    start = 0x08000000ul;
> -#  endif
> -# endif
> -
> -    buf = mmap((void *)start, size, prot, flags, -1, 0);
> +    buf = mmap(NULL, size, prot, flags, -1, 0);
>      if (buf == MAP_FAILED) {
>          return NULL;
>      }
>  
>  #ifdef __mips__
>      if (cross_256mb(buf, size)) {
> -        /* Try again, with the original still mapped, to avoid re-acquiring
> -           that 256mb crossing.  This time don't specify an address.  */
> +        /*
> +         * Try again, with the original still mapped, to avoid re-acquiring
> +         * the same 256mb crossing.
> +         */
>          size_t size2;
>          void *buf2 = mmap(NULL, size, prot, flags, -1, 0);
>          switch ((int)(buf2 != MAP_FAILED)) {
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



  reply	other threads:[~2019-12-18  7:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  3:19 [PATCH 0/7] configure: Improve PIE and other linkage Richard Henderson
2019-12-18  3:19 ` [PATCH 1/7] configure: Drop adjustment of textseg Richard Henderson
2019-12-18  6:59   ` Thomas Huth
2019-12-18 17:22     ` Richard Henderson
2019-12-18  3:19 ` [PATCH 2/7] tcg: Remove softmmu code_gen_buffer fixed address Richard Henderson
2019-12-18  7:01   ` Thomas Huth [this message]
2019-12-18  3:19 ` [PATCH 3/7] configure: Do not force pie=no for non-x86 Richard Henderson
2019-12-18  7:05   ` Thomas Huth
2019-12-18 19:23     ` Richard Henderson
2019-12-18  3:19 ` [PATCH 4/7] configure: Always detect -no-pie toolchain support Richard Henderson
2019-12-18  8:04   ` Thomas Huth
2019-12-18 17:55   ` Philippe Mathieu-Daudé
2019-12-18  3:19 ` [PATCH 5/7] configure: Unnest detection of -z,relro and -z,now Richard Henderson
2019-12-18  8:11   ` Thomas Huth
2019-12-18 16:58     ` Richard Henderson
2019-12-18 18:31       ` Thomas Huth
2019-12-18  3:19 ` [PATCH 6/7] configure: Override the os default with --disable-pie Richard Henderson
2019-12-18  8:13   ` Thomas Huth
2019-12-18 17:57   ` Philippe Mathieu-Daudé
2019-12-18  3:19 ` [PATCH 7/7] configure: Support -static-pie if requested Richard Henderson
2019-12-18  8:15   ` Thomas Huth
2019-12-18  7:28 ` [PATCH 0/7] configure: Improve PIE and other linkage Fangrui Song
2019-12-18 22:32   ` Richard Henderson

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=b50b200c-beee-6c8b-d8f9-994555427576@redhat.com \
    --to=thuth@redhat.com \
    --cc=berrange@redhat.com \
    --cc=i@maskray.me \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 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).