Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp963585imm; Fri, 3 Aug 2018 15:03:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcSRtmv3M+Yk5G/Sv8jjsKxVOtXfJjbR8M3GYNiV7Y52eQWyf/mlkkqqSzd3Zr7CxfofWqt X-Received: by 2002:a63:ce43:: with SMTP id r3-v6mr5360082pgi.439.1533333809010; Fri, 03 Aug 2018 15:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533333808; cv=none; d=google.com; s=arc-20160816; b=cHvodPn8yMawBQ6YZFRtvS6rzhgq8MJa6JEic7vgjmy/ItnSMqvHW9XHG8B/mfjODm AGjw4fgkooqn9hzjDTlPhY1bh3kfgbIPJDFb+Q/OeO0tFMQ+bSjEvmdlRsdYUvk+Wyzn 5VLn3G0AsMmqqHpTpjxtfjRIvpGSUYsSF6UFKwSDVKBK59mUtUwM30ybuFOTrPLe3tB6 T5PET2QIXrkX3EPOmX3rGnPaZor8tPST8u/zOIp6P4XRqt93jK1VKxv/wJcbaT+DXQCj iUU9vp7GYjYMwGye/1c8i2u0p8blK2LbCmXyPNhIicpvYUB5jeaSodtKGeGRB24BVOGG UBvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=i3Hlk4O8egA/jjefTVE1vaHtPjh1Iw/EO1TxKV8KliE=; b=T4QDW4yqa7+0blX9awBwJrkOuIpPu7604XCDEuslrVEWCVOHP2Ta8auYMad8buFS9k xObSpgikJapJGPchbB7DeeNA1mpf64YvsqFOxZ8TWzFa6uxIqDboNeKd4P/KpnALSl3a WQ1WHGc+sSNjMD1Pvh/Sh7BrPVzuQ4vClnVoNgVCsCYNc63vxkbbiMiL8+hCD6ztUal5 T1a8WF+MTOHTZwzCEgc+1AZTpyOJvxlS2Rge6gUeJk3nb8t/zPXP+AmUR23QSLIGSMEX twjFAgqc1RsBJZZO1Oa64JgSXcwG5tOwb8YGMcFla2U+uhVEix5Vh/i/22t3WteDb8hK iTmA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11-v6si4342132plr.131.2018.08.03.15.03.14; Fri, 03 Aug 2018 15:03:28 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732147AbeHCX71 (ORCPT + 99 others); Fri, 3 Aug 2018 19:59:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49732 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731741AbeHCX71 (ORCPT ); Fri, 3 Aug 2018 19:59:27 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73LuFBt021603 for ; Fri, 3 Aug 2018 18:01:18 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kmwghuv27-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 18:01:17 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 16:01:17 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 3 Aug 2018 16:01:14 -0600 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73M1BuR66781268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 15:01:11 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E67A78060; Fri, 3 Aug 2018 16:01:11 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17A737805F; Fri, 3 Aug 2018 16:01:09 -0600 (MDT) Received: from morokweng.localdomain.com (unknown [9.85.156.5]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 3 Aug 2018 16:01:08 -0600 (MDT) From: Thiago Jung Bauermann To: linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Shuah Khan , Andrea Arcangeli , Mike Rapoport , Prakash Sangappa , Thiago Jung Bauermann Subject: [PATCH v2 2/4] userfaultfd: selftest: Skip test if userfaultfd() syscall not supported Date: Fri, 3 Aug 2018 19:00:44 -0300 X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180803220046.4019-1-bauerman@linux.ibm.com> References: <20180803220046.4019-1-bauerman@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18080322-0012-0000-0000-000016970ECB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009479; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01069606; UDB=6.00550093; IPR=6.00848260; MB=3.00022492; MTD=3.00000008; XFM=3.00000015; UTC=2018-08-03 22:01:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080322-0013-0000-0000-000053E8A05E Message-Id: <20180803220046.4019-3-bauerman@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-03_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=729 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808030236 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since there's no point in doing anything in this case, immediately exit the process. And take the opportunity to improve the error message. Before: # ./userfaultfd shmem 10 10 nr_pages: 160, nr_pages_per_cpu: 40 userfaultfd syscall not available in this kernel # echo $? 1 After: # ./userfaultfd shmem 10 10 nr_pages: 160, nr_pages_per_cpu: 40 userfaultfd syscall not available in this kernel: Function not implemented # echo $? 4 Suggested-by: Mike Rapoport Signed-off-by: Thiago Jung Bauermann --- tools/testing/selftests/vm/userfaultfd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/userfaultfd.c b/tools/testing/selftests/vm/userfaultfd.c index e4099afe7557..d728bd1cb33c 100644 --- a/tools/testing/selftests/vm/userfaultfd.c +++ b/tools/testing/selftests/vm/userfaultfd.c @@ -636,9 +636,11 @@ static int userfaultfd_open(int features) uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK); if (uffd < 0) { - fprintf(stderr, - "userfaultfd syscall not available in this kernel\n"); - return 1; + int errnum = errno; + + perror("userfaultfd syscall not available in this kernel"); + + exit(errnum == ENOSYS ? KSFT_SKIP : 1); } uffd_flags = fcntl(uffd, F_GETFD, NULL);