kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Andre Przywara <andre.przywara@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Cc: Marc Zyngier <Marc.Zyngier@arm.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [PATCH 11/12] avoid using predefined PAGE_SIZE
Date: Fri, 17 Jul 2015 17:47:10 +0100	[thread overview]
Message-ID: <55A9318E.1000700@arm.com> (raw)
In-Reply-To: <1437148938-5394-12-git-send-email-andre.przywara@arm.com>

On 17/07/15 17:02, Andre Przywara wrote:
> The musl-libc comes with a predefined PAGE_SIZE macro, which may be
> wrong on systems which support multiple smallest page sizes.
> Make sure we use our own (runtime evaluated) definition of PAGE_SIZE.
>

musl only provides PAGE_SIZE on archs where it is
constant, if not, that's a musl bug and should be
fixed there (this is a posix requirement).

the ifdef does not help around this: musl sysconf
will return the same value as you get from the
header (it would be a conformance bug otherwise).

use

#include <limits.h>
#ifndef PAGE_SIZE
#define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
#endif

> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  include/kvm/kvm.h | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h
> index 9818046..8b12cd6 100644
> --- a/include/kvm/kvm.h
> +++ b/include/kvm/kvm.h
> @@ -19,6 +19,10 @@
>  #define HOME_DIR             getenv("HOME")
>  #define KVM_BINARY_NAME              "lkvm"
>
> +/* Let's determine the actual page size at runtime. */
> +#ifdef PAGE_SIZE
> +#undef PAGE_SIZE
> +#endif
>  #define PAGE_SIZE (sysconf(_SC_PAGE_SIZE))
>
>  #define DEFINE_KVM_EXT(ext)          \
>


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782


  reply	other threads:[~2015-07-17 16:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-17 16:02 [PATCH 00/12] kvmtool: Improve portability Andre Przywara
2015-07-17 16:02 ` [PATCH 01/12] avoid casts when initializing structures Andre Przywara
2015-07-17 16:02 ` [PATCH 02/12] qcow: fix signedness bugs Andre Przywara
2015-07-17 16:02 ` [PATCH 03/12] kvm-ipc: use proper type for file descriptor Andre Przywara
2015-07-17 16:02 ` [PATCH 04/12] Makefile: remove unneeded -s switch on compiling BIOS files Andre Przywara
2015-07-17 16:02 ` [PATCH 05/12] ui: remove pointless double const in keymap declarations Andre Przywara
2015-07-17 16:02 ` [PATCH 06/12] kvm__set_dir(): avoid variable arguments call Andre Przywara
2015-07-17 16:49   ` Will Deacon
2015-07-17 16:02 ` [PATCH 07/12] util/util.c: avoid clang error on vsnprintf Andre Przywara
2015-07-17 16:50   ` Will Deacon
2015-07-20 14:28     ` Claudio Fontana
2015-07-20 14:46       ` Andre Przywara
2015-07-17 16:02 ` [PATCH 08/12] Fix call to connect() Andre Przywara
2015-07-17 16:02 ` [PATCH 09/12] use <poll.h> instead of <sys/poll.h> Andre Przywara
2015-07-17 16:02 ` [PATCH 10/12] check for and use C library provided strlcpy and strlcat Andre Przywara
2015-07-17 16:02 ` [PATCH 11/12] avoid using predefined PAGE_SIZE Andre Przywara
2015-07-17 16:47   ` Szabolcs Nagy [this message]
2015-07-17 16:02 ` [PATCH 12/12] remove KVM_CAP_MAX_VCPUS hack Andre Przywara
2015-07-17 16:52 ` [PATCH 00/12] kvmtool: Improve portability Will Deacon

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=55A9318E.1000700@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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).