From patchwork Tue Jul 17 13:49:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 945085 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41VNSf4bL4z9rxs for ; Wed, 18 Jul 2018 00:48:34 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cnjQzVcc"; 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 41VNSf2twzzF3Hk for ; Wed, 18 Jul 2018 00:48:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com 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="cnjQzVcc"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c09::241; helo=mail-qk0-x241.google.com; envelope-from=ram.n.pai@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cnjQzVcc"; dkim-atps=neutral Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) (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 41VM9p5h8vzF3Hh for ; Tue, 17 Jul 2018 23:50:38 +1000 (AEST) Received: by mail-qk0-x241.google.com with SMTP id u21-v6so516384qku.2 for ; Tue, 17 Jul 2018 06:50:38 -0700 (PDT) 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=cb/n276Xxe2U8txtUJ8tHphmr2TB1hqLIHEdC9jJtzc=; b=cnjQzVccnZsI3MxcWqgv7wu8Gyw9XSWjFqpBT5cy6rE9mcaP3uVzRh706+Leq8hkAk Q4SqbnvgKqX8dKdn+ehW+q+F1JLircRshYGI9DNo8hmZ9rKWccZthDlHdMa7gc6kTlcD +FsBxuwTDo0nEi8EnHag24YcPr0irtVdro1kED/oagEq6RKi+LNnU04Rju6uskCuPyv8 CjvUb50LGp9MI9cymubyUPmui9FO4jlctp2scbda/BGMeR2USVpp9dUwLQ7074fqnfhm uzCRr7SlyYaWs7zetImG/X5LBiGLSdpJTNvle7YQrvEBUIN3kmYbA7a89kdY3gkwBnnI trvw== 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=cb/n276Xxe2U8txtUJ8tHphmr2TB1hqLIHEdC9jJtzc=; b=SAJH9TkfgiSXkE1VYneNIhwzpQiu92SoMBkrbowzpI2maEpWDHKWYSDVVO10jQfM4N KW4GJ1TaSdaQJZ8f5+eIYJ5sUv75ZiL7oHTRbaZtW5ghASN101cXk5zOac7eeldLDkzP F9tx3i84LbxOD8QEczU1VfzbiNMytfgXNixmEHlTbD0mArBBvjHY3yqtDhPLsUTCPNOr 11EXP6ddb2PktR5XUIb7jFQXfjdFRuChNf213ktj8m+fq4hRUBhDj+NIIIlt53HIxXN/ 7ozmVcZHh8+KiNTjNmmnXx/tDaP29kjuwvSQY+bAHtNm3MbKtNFk7eX2kPQIQYp+0ZeI e+OQ== X-Gm-Message-State: AOUpUlEEaIkqxOfugWRqsKxwVt85WlJ/mhjJASkK7QBA+teki9WGTv+r heISCYLKppfFGMm7SQcy290= X-Google-Smtp-Source: AAOMgpfbt/T+9epouC5j+lm5WX16FKDuPtgJ38fd+LUHkNOdwYaV0KrFxaAds7J5w/qMucXlcdeiHA== X-Received: by 2002:a37:8346:: with SMTP id f67-v6mr1437903qkd.18.1531835436903; Tue, 17 Jul 2018 06:50:36 -0700 (PDT) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id s83-v6sm640937qki.20.2018.07.17.06.50.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jul 2018 06:50:36 -0700 (PDT) From: Ram Pai To: shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org Subject: [PATCH v14 16/22] selftests/vm: fix an assertion in test_pkey_alloc_exhaust() Date: Tue, 17 Jul 2018 06:49:19 -0700 Message-Id: <1531835365-32387-17-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1531835365-32387-1-git-send-email-linuxram@us.ibm.com> References: <1531835365-32387-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, fweimer@redhat.com, dave.hansen@intel.com, x86@kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, mingo@redhat.com, aneesh.kumar@linux.vnet.ibm.com, bauerman@linux.vnet.ibm.com, msuchanek@suse.de, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The maximum number of keys that can be allocated has to take into consideration, that some keys are reserved by the architecture for specific purpose. Hence cannot be allocated. Fix the assertion in test_pkey_alloc_exhaust() cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index d27fa5e..67d841e 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -1171,15 +1171,11 @@ void test_pkey_alloc_exhaust(int *ptr, u16 pkey) pkey_assert(i < NR_PKEYS*2); /* - * There are 16 pkeys supported in hardware. Three are - * allocated by the time we get here: - * 1. The default key (0) - * 2. One possibly consumed by an execute-only mapping. - * 3. One allocated by the test code and passed in via - * 'pkey' to this function. - * Ensure that we can allocate at least another 13 (16-3). + * There are NR_PKEYS pkeys supported in hardware. arch_reserved_keys() + * are reserved. And one key is allocated by the test code and passed + * in via 'pkey' to this function. */ - pkey_assert(i >= NR_PKEYS-3); + pkey_assert(i >= (NR_PKEYS-arch_reserved_keys()-1)); for (i = 0; i < nr_allocated_pkeys; i++) { err = sys_pkey_free(allocated_pkeys[i]);