Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4371566imm; Mon, 6 Aug 2018 23:53:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd/dtbR1VU1c1ixmOyypAls3fONehtBcZrmgWvCk2zLM0M26sWbtymWA/v+P7MZtPbRxZNw X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr16515114pld.98.1533624831200; Mon, 06 Aug 2018 23:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533624831; cv=none; d=google.com; s=arc-20160816; b=GPUc6DE1AckL0W4B1kBnMAGkwB/xBz+DG3/x5EkWos4yTVvM+T5xzNJPw9Lf9RXxYs euLoiW07Ur7g88xqnEVOZXWh9BGWx1ktJYNoCxZ8I9HWcZ9wscfNK2U4ezT4e5s6ljTz mLXW9eZ5XtChdYjspB9+NvnYFz/kaSeas6gS/qY91bY3fvkkSQHm+TScPK/b4Bk42Wby 12RfFFUQn6mRGles8lrJe24TQZiyaxarzIiivKGa8sJrpB9wJa5UuPMBNT5Z17RVZDMY /W7aXhTV0Z1nxMr128HNCAuK+N6IbGoF0gIUTOvcPo8f2tJ9DUXIyqZClDz3bR2gEflh WFWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date :arc-authentication-results; bh=Z7hZm00xzrdbMGqfRgrlJVAAAm2f1fGhpBBunAirmcA=; b=sxfB9RQVvIUWewm4kG2qeYtpyP2qoXE7Zp5m9kCT7IJCRXth7P1P2GV8pllW9tPhOz hYWShqPga/KPv53QIMALHMzI+XlQkb1kk3br6Qf5Rau7jaFw/PLQ2ZLe17vNs7u2ML+3 7nB1Asf/9PCd10qJrUQFsF1+Emams0gy6DTATbRAoBhkho0Vx/nW6vj2P12qCKISFmv3 l84B74MvgcWGrowXBzSrObwKCaj6Q3hK1w6EdZzIP34zs90kWKMFPVaxdDR/eO4/L7Bi ZAA5eFljI3Iw6ytQPVKiAAXGfwu1GnAWpTOrUoiK8qzgjsTdqFyl2FEJkFY+swsJ9N4w Dndg== 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 35-v6si533093pla.453.2018.08.06.23.53.37; Mon, 06 Aug 2018 23:53:51 -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 S2388717AbeHGJEB (ORCPT + 99 others); Tue, 7 Aug 2018 05:04:01 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33630 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727360AbeHGJEB (ORCPT ); Tue, 7 Aug 2018 05:04:01 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w776nS3m071282 for ; Tue, 7 Aug 2018 02:51:09 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kq1r09r00-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Aug 2018 02:51:09 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Aug 2018 07:51:07 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 7 Aug 2018 07:51:03 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w776p2C533620174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 7 Aug 2018 06:51:02 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6ED1611C05C; Tue, 7 Aug 2018 09:51:10 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 204C711C04C; Tue, 7 Aug 2018 09:51:09 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.206.72]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 7 Aug 2018 09:51:08 +0100 (BST) Date: Tue, 7 Aug 2018 09:50:59 +0300 From: Mike Rapoport To: Thiago Jung Bauermann Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Andrea Arcangeli , Prakash Sangappa Subject: Re: [PATCH v2 2/4] userfaultfd: selftest: Skip test if userfaultfd() syscall not supported References: <20180803220046.4019-1-bauerman@linux.ibm.com> <20180803220046.4019-3-bauerman@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180803220046.4019-3-bauerman@linux.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18080706-0028-0000-0000-000002E73AEE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080706-0029-0000-0000-000023A03DDF Message-Id: <20180807065057.GB20140@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-07_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=870 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808070071 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 03, 2018 at 07:00:44PM -0300, Thiago Jung Bauermann wrote: > 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 Acked-by: Mike Rapoport > --- > 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); > -- Sincerely yours, Mike.