Message ID | 1509958663-18737-42-git-send-email-linuxram@us.ibm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org> X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVqFd6j6Hz9s7h for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 21:54:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AEsUZ6TS"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yVqFd5KnqzDrKg for <patchwork-incoming@ozlabs.org>; Mon, 6 Nov 2017 21:54:45 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AEsUZ6TS"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c09::244; helo=mail-qk0-x244.google.com; envelope-from=ram.n.pai@gmail.com; receiver=<UNKNOWN>) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AEsUZ6TS"; dkim-atps=neutral Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yVmjV40tCzDr5T for <linuxppc-dev@lists.ozlabs.org>; Mon, 6 Nov 2017 20:00:14 +1100 (AEDT) Received: by mail-qk0-x244.google.com with SMTP id y23so9992288qkb.10 for <linuxppc-dev@lists.ozlabs.org>; Mon, 06 Nov 2017 01:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=RWwHpg/Ts30eobD2e//6APSsRFyIWIzQJakPNzyxnSs=; b=AEsUZ6TSdr5Gr8YkcwWrEAkEgRsqwEdkrdUOja1zDirBM4JfLRX8l2wVVyZRvzJMnx pAh2WA7EVvihAvACdo3SkFSbI5cb1woPha+d24et3Opq15gY40BBXTzQdJvv/FoWC/lm mYQeDfGnb/ahEOyaOgrQzhA3YDqayZAHj6M0QVY9oMm2wYA5jxs0EmwnOaoQrohHOBuC PMYC8mQ0FQ6zdgv7HKmyUOHUtyuspVAo3zuQkt/llG5p8Mwt7a24WMwrT8a9V2c2AIIl r7y3hwtOasrFnVwHzX4b9E0P01WIQSU9S1zzIJJTws8eDteYIB+rZqC/FYPEUZvzJVDk cO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=RWwHpg/Ts30eobD2e//6APSsRFyIWIzQJakPNzyxnSs=; b=N+JmHLayD8xCy4os8bKL5eK1O2wlAD7YMMn9/R4vMX1uZPDOeU4ZL2Sb8w772cL6ol jilEe2xWM7PbD5+CCxAgjQq4tPW1ZUGofJFxMZ8asHJVDwaQEcM5FP/BVMTmh5s9W9n+ X14DUh76SDptao5Hl9gRwfESZg3cUsVkKWGs8/tex4UJxBvUye84nfXCs31ZTiGdOr/t a/u1jNF+KiMhiAB+9vq+GZJha3qmRVkKICSdKFy52a8V/J0XedtumzU2JhtGryGUlTxi yhOdv5+58GorugPo3drOFe34Z6ma/Gdn3753CGNN3jFOI2rwBiOKgcNb0yq4pwBPSeMw 8WXQ== X-Gm-Message-State: AMCzsaUwZV5N28minNhaTPAMyK2Ycu6JqT09PDMCkISUvFKaAeEwnxQp iHb+f9W/1Hzwl5k9COqD7N0= X-Google-Smtp-Source: ABhQp+SZaXP3X6nfXTJ1IN0BHWXruViQ8FvR6ZIZQqb9cOqm+6kwbp6ZumUijokdu1TVcd31PjrUcg== X-Received: by 10.55.184.71 with SMTP id i68mr19568175qkf.150.1509958812636; Mon, 06 Nov 2017 01:00:12 -0800 (PST) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id r26sm8001094qki.42.2017.11.06.01.00.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 01:00:12 -0800 (PST) From: Ram Pai <linuxram@us.ibm.com> To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de Subject: [PATCH v9 41/51] selftest/vm: introduce two arch independent abstraction Date: Mon, 6 Nov 2017 00:57:33 -0800 Message-Id: <1509958663-18737-42-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> References: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org> List-Unsubscribe: <https://lists.ozlabs.org/options/linuxppc-dev>, <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe> List-Archive: <http://lists.ozlabs.org/pipermail/linuxppc-dev/> List-Post: <mailto:linuxppc-dev@lists.ozlabs.org> List-Help: <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help> List-Subscribe: <https://lists.ozlabs.org/listinfo/linuxppc-dev>, <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe> Cc: linux-arch@vger.kernel.org, ebiederm@xmission.com, linux-doc@vger.kernel.org, x86@kernel.org, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org> |
Series |
powerpc, mm: Memory Protection Keys
|
expand
|
diff --git a/tools/testing/selftests/vm/pkey-helpers.h b/tools/testing/selftests/vm/pkey-helpers.h index d521f53..30755be 100644 --- a/tools/testing/selftests/vm/pkey-helpers.h +++ b/tools/testing/selftests/vm/pkey-helpers.h @@ -301,3 +301,14 @@ static inline void __page_o_noops(void) } \ } while (0) #define raw_assert(cond) assert(cond) + +static inline int open_hugepage_file(int flag) +{ + return open("/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages", + O_RDONLY); +} + +static inline int get_start_key(void) +{ + return 1; +} diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 1a14027..19ae991 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -809,7 +809,7 @@ void setup_hugetlbfs(void) * Now go make sure that we got the pages and that they * are 2M pages. Someone might have made 1G the default. */ - fd = open("/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages", O_RDONLY); + fd = open_hugepage_file(O_RDONLY); if (fd < 0) { perror("opening sysfs 2M hugetlb config"); return; @@ -1087,10 +1087,10 @@ void test_kernel_gup_write_to_write_disabled_region(int *ptr, u16 pkey) void test_pkey_syscalls_on_non_allocated_pkey(int *ptr, u16 pkey) { int err; - int i; + int i = get_start_key(); /* Note: 0 is the default pkey, so don't mess with it */ - for (i = 1; i < NR_PKEYS; i++) { + for (; i < NR_PKEYS; i++) { if (pkey == i) continue;
open_hugepage_file() <- opens the huge page file get_start_key() <-- provides the first non-reserved key. Signed-off-by: Ram Pai <linuxram@us.ibm.com> --- tools/testing/selftests/vm/pkey-helpers.h | 11 +++++++++++ tools/testing/selftests/vm/protection_keys.c | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-)