mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <shuah@kernel.org>
To: Michal Suchanek <msuchanek@suse.de>,
	Anshuman Khandual <khandual@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v2] selftests/vm: Fix test for virtual address range mapping for arm64
Date: Fri, 2 Jun 2017 15:38:38 -0600	[thread overview]
Message-ID: <3c346b84-57c5-e39d-fe9b-6bfddfe0864f@kernel.org> (raw)
In-Reply-To: <20170518125258.2983-1-msuchanek@suse.de>

On 05/18/2017 06:52 AM, Michal Suchanek wrote:
> Arm64 has 256TB address space so fix the test to pass on Arm as well.
> 
> Also remove unneeded numaif header.
> 
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>

Thanks. Applied to linux-kselftest next for 4.13-rc1

-- Shuah

> ---
> v2:
>  - do not test high slices on Arm64 - it has no support and none is planned
>  - fix the hint calculation for different shift
> ---
>  tools/testing/selftests/vm/virtual_address_range.c | 35 ++++++++++++++++------
>  1 file changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/testing/selftests/vm/virtual_address_range.c b/tools/testing/selftests/vm/virtual_address_range.c
> index 3b02aa6eb9da..1830d66a6f0e 100644
> --- a/tools/testing/selftests/vm/virtual_address_range.c
> +++ b/tools/testing/selftests/vm/virtual_address_range.c
> @@ -10,7 +10,6 @@
>  #include <string.h>
>  #include <unistd.h>
>  #include <errno.h>
> -#include <numaif.h>
>  #include <sys/mman.h>
>  #include <sys/time.h>
>  
> @@ -32,15 +31,33 @@
>   * different areas one below 128TB and one above 128TB
>   * till it reaches 512TB. One with size 128TB and the
>   * other being 384TB.
> + *
> + * On Arm64 the address space is 256TB and no high mappings
> + * are supported so far.
>   */
> +
>  #define NR_CHUNKS_128TB   8192UL /* Number of 16GB chunks for 128TB */
> -#define NR_CHUNKS_384TB  24576UL /* Number of 16GB chunks for 384TB */
> +#define NR_CHUNKS_256TB   (NR_CHUNKS_128TB * 2UL)
> +#define NR_CHUNKS_384TB   (NR_CHUNKS_128TB * 3UL)
>  
>  #define ADDR_MARK_128TB  (1UL << 47) /* First address beyond 128TB */
> +#define ADDR_MARK_256TB  (1UL << 48) /* First address beyond 256TB */
> +
> +#ifdef __aarch64__
> +#define HIGH_ADDR_MARK  ADDR_MARK_256TB
> +#define HIGH_ADDR_SHIFT 49
> +#define NR_CHUNKS_LOW   NR_CHUNKS_256TB
> +#define NR_CHUNKS_HIGH  0
> +#else
> +#define HIGH_ADDR_MARK  ADDR_MARK_128TB
> +#define HIGH_ADDR_SHIFT 48
> +#define NR_CHUNKS_LOW   NR_CHUNKS_128TB
> +#define NR_CHUNKS_HIGH  NR_CHUNKS_384TB
> +#endif
>  
>  static char *hind_addr(void)
>  {
> -	int bits = 48 + rand() % 15;
> +	int bits = HIGH_ADDR_SHIFT + rand() % (63 - HIGH_ADDR_SHIFT);
>  
>  	return (char *) (1UL << bits);
>  }
> @@ -50,14 +67,14 @@ static int validate_addr(char *ptr, int high_addr)
>  	unsigned long addr = (unsigned long) ptr;
>  
>  	if (high_addr) {
> -		if (addr < ADDR_MARK_128TB) {
> +		if (addr < HIGH_ADDR_MARK) {
>  			printf("Bad address %lx\n", addr);
>  			return 1;
>  		}
>  		return 0;
>  	}
>  
> -	if (addr > ADDR_MARK_128TB) {
> +	if (addr > HIGH_ADDR_MARK) {
>  		printf("Bad address %lx\n", addr);
>  		return 1;
>  	}
> @@ -79,12 +96,12 @@ static int validate_lower_address_hint(void)
>  
>  int main(int argc, char *argv[])
>  {
> -	char *ptr[NR_CHUNKS_128TB];
> -	char *hptr[NR_CHUNKS_384TB];
> +	char *ptr[NR_CHUNKS_LOW];
> +	char *hptr[NR_CHUNKS_HIGH];
>  	char *hint;
>  	unsigned long i, lchunks, hchunks;
>  
> -	for (i = 0; i < NR_CHUNKS_128TB; i++) {
> +	for (i = 0; i < NR_CHUNKS_LOW; i++) {
>  		ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE,
>  					MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
>  
> @@ -99,7 +116,7 @@ int main(int argc, char *argv[])
>  	}
>  	lchunks = i;
>  
> -	for (i = 0; i < NR_CHUNKS_384TB; i++) {
> +	for (i = 0; i < NR_CHUNKS_HIGH; i++) {
>  		hint = hind_addr();
>  		hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE,
>  					MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> 

      reply	other threads:[~2017-06-02 21:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 12:52 Michal Suchanek
2017-06-02 21:38 ` Shuah Khan [this message]

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=3c346b84-57c5-e39d-fe9b-6bfddfe0864f@kernel.org \
    --to=shuah@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=msuchanek@suse.de \
    /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

Powered by JetHome