qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 2/3] bsd-user: Propagate alignment argument to mmap_find_vma()
Date: Fri, 7 Mar 2025 08:08:42 -0800	[thread overview]
Message-ID: <3792e6ce-3dd8-41ad-bbc8-313fe4309e2f@linaro.org> (raw)
In-Reply-To: <20250307130951.4816-3-philmd@linaro.org>

On 3/7/25 05:09, Philippe Mathieu-Daudé wrote:
> Propagate the alignment to mmap_find_vma(), effectively
> embedding mmap_find_vma_aligned() within mmap_find_vma().
> 
> Since we ignore the alignment in do_bsd_shmat(), leave a
> FIXME comment.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   bsd-user/bsd-mem.h |  2 +-
>   bsd-user/qemu.h    |  2 +-
>   bsd-user/mmap.c    | 10 ++--------
>   3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/bsd-user/bsd-mem.h b/bsd-user/bsd-mem.h
> index f5ec0de24ca..87219da2919 100644
> --- a/bsd-user/bsd-mem.h
> +++ b/bsd-user/bsd-mem.h
> @@ -372,7 +372,7 @@ static inline abi_long do_bsd_shmat(int shmid, abi_ulong shmaddr, int shmflg)
>           } else {
>               abi_ulong mmap_start;
>   
> -            mmap_start = mmap_find_vma(0, shm_info.shm_segsz);
> +            mmap_start = mmap_find_vma(0, shm_info.shm_segsz, 0 /* FIXME??? */);

It's not really ignoring the alignment, but not requiring alignment above page size.

Traditionally, the alignment for shmat should be SHMLBA.
But in current freebsd sources,

sys/sys/shm.h:#define SHMLBA      PAGE_SIZE /* Segment low boundary address multiple */

there are no crazy broken old architectures to worry about.


r~


  reply	other threads:[~2025-03-07 16:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 13:09 [PATCH v3 0/3] user: Extract common MMAP API to 'user/mmap.h' Philippe Mathieu-Daudé
2025-03-07 13:09 ` [PATCH v3 1/3] bsd-user: Always use mmap_find_vma_aligned() in target_mmap() Philippe Mathieu-Daudé
2025-03-07 16:03   ` Richard Henderson
2025-03-09 23:21   ` Warner Losh
2025-03-07 13:09 ` [PATCH v3 2/3] bsd-user: Propagate alignment argument to mmap_find_vma() Philippe Mathieu-Daudé
2025-03-07 16:08   ` Richard Henderson [this message]
2025-03-07 16:17     ` Philippe Mathieu-Daudé
2025-03-09 23:20   ` Warner Losh
2025-03-07 13:09 ` [PATCH v3 3/3] user: Extract common MMAP API to 'user/mmap.h' Philippe Mathieu-Daudé

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=3792e6ce-3dd8-41ad-bbc8-313fe4309e2f@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.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).