Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2178722imm; Mon, 28 May 2018 03:20:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpj/DZY3/rkmJ2IzBzmFwQC4AY9CyqQX7cazfKvBDNBnw127qPgQYHpOPS5UfV6DmhyNPOx X-Received: by 2002:a17:902:7595:: with SMTP id j21-v6mr13001780pll.347.1527502806028; Mon, 28 May 2018 03:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527502806; cv=none; d=google.com; s=arc-20160816; b=yab8s9SD0nVczQ/b/1EZI/VLArqsILJO5P9uhawQl38xfUYNyvuGZxbpFDXgU5cEUp Qnr0gdhBbLn5KHvPd55tE0ytgmwmF4t5UmAaWYVc0n/9h8ZTEsgerhyIgiZSFLduK/8q Q/6MFojTV6Bg9SKy8auaKjnKKI1+lYUeimxchBzA+p4+2cvO/ss6fLqrUgU+F3GySkDk ZNDHN41mE8yTdp2SfPgnzJ4l02tMssfP5Nh+AEUZZIbsk1KBt/Di9GpHlveoQbxgpaVf jZb8cuQS0f+VnaxlBmCep6e0Ohz79Ep+zYc0cMieMyXOzqaTNsn/yxYDP9WHadK87Zqe YoHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=chLmRJmmyt831a2t873xQKCeoYdWLDUIReXyj9CLVNw=; b=BGzlTTlRxV2UfATrRkMqY6HMy++QunRY83NY8uZZ5NjnBfA56h8p5jig+ykjNoC1AY CtWAbXfTvz7aJmfxMG7tnB/uA0xtU37BuV1PCplynYVk1Lhp0Sdo8oUOqFZFyuYTSdKU BrDQeKyjpInji8daaLVpBNrkQWthz0CM39OHgWfW93mGWROi33h28I+3DM3yRNdfUZL0 j9zdJTaQdhf2Sl1oQRNTbuJuT9T/G3Zw9x+sdM43kRqPUmmd9LQc8N8gQGhsHMh1bksG 8jABmG/neTa1S2C8hUJBxVMiD746uFNVXYoUDO5dC3Dp4+e8sG12botuEgfCiHWsEMq2 vpQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kHPb2K+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si29925768plz.364.2018.05.28.03.19.51; Mon, 28 May 2018 03:20:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kHPb2K+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032822AbeE1KTd (ORCPT + 99 others); Mon, 28 May 2018 06:19:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:39328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936919AbeE1KTW (ORCPT ); Mon, 28 May 2018 06:19:22 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C703E206B7; Mon, 28 May 2018 10:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502762; bh=FAonWMh+2Fjln2ek4qYX4+BsyAtQF8cUc7E8HA3B5cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHPb2K+RNKhOoWjH3h4MBi7gvzy+21wH+Js2P00v/rlo2P9BBqzVqkdV1bpK7+uxS Mu6ZYVB+KB952WATO3Wjx5kl2nHg39SF2SAWzoKZvHQlmidMRMHpRnWdOmXqFoiCQm C4NxgFy3mJIYZJHCTRx+zJwy0RW+FxRfihCMVfG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 4.4 121/268] selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable Date: Mon, 28 May 2018 12:01:35 +0200 Message-Id: <20180528100215.810823852@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100202.045206534@linuxfoundation.org> References: <20180528100202.045206534@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman [ Upstream commit cd4a6f3ab4d80cb919d15897eb3cbc85c2009d4b ] The subpage_prot syscall is only functional when the system is using the Hash MMU. Since commit 5b2b80714796 ("powerpc/mm: Invalidate subpage_prot() system call on radix platforms") it returns ENOENT when the Radix MMU is active. Currently this just makes the test fail. Additionally the syscall is not available if the kernel is built with 4K pages, or if CONFIG_PPC_SUBPAGE_PROT=n, in which case it returns ENOSYS because the syscall is missing entirely. So check explicitly for ENOENT and ENOSYS and skip if we see either of those. Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/powerpc/mm/subpage_prot.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/tools/testing/selftests/powerpc/mm/subpage_prot.c +++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c @@ -135,6 +135,16 @@ static int run_test(void *addr, unsigned return 0; } +static int syscall_available(void) +{ + int rc; + + errno = 0; + rc = syscall(__NR_subpage_prot, 0, 0, 0); + + return rc == 0 || (errno != ENOENT && errno != ENOSYS); +} + int test_anon(void) { unsigned long align; @@ -145,6 +155,8 @@ int test_anon(void) void *mallocblock; unsigned long mallocsize; + SKIP_IF(!syscall_available()); + if (getpagesize() != 0x10000) { fprintf(stderr, "Kernel page size must be 64K!\n"); return 1; @@ -180,6 +192,8 @@ int test_file(void) off_t filesize; int fd; + SKIP_IF(!syscall_available()); + fd = open(file_name, O_RDWR); if (fd == -1) { perror("failed to open file");