Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4157550pxb; Mon, 21 Feb 2022 13:33:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtSEVXSEpDWd7tVVucbiXkvdO5U8jZjwR15UcrfxKeaZaQnOq1DiCWXCoyEUzyDJv+RwrB X-Received: by 2002:a17:907:2be6:b0:6ce:70da:12c2 with SMTP id gv38-20020a1709072be600b006ce70da12c2mr17738374ejc.649.1645479184804; Mon, 21 Feb 2022 13:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645479184; cv=none; d=google.com; s=arc-20160816; b=S2KnHcJpP7RtwGWfdy+t9osgqetfZoAAVHDS1pf1dhTG6XUloeligWXLmGYqRFvzSy kU2Bmko4cMwiftEa8m/Mqau+LqgeDEZHCzl5NlPPRKI5IXnRZ7m0jvmiYro7OsRyC0TJ rdjh58sAv5AQPkf4+x7aiWmzMTVPJ8diWs14Q724rpoJgQR0P69cZN2Ajptd4Sr1FjCJ yHS0S9C2dKJ0UDngwqgsHcv+QTC8T5EEtkdKolwSD0TbUbR7JZeK6puBUSSafWfKpDbm 8Qyyw2PRdi5Ax42yQRZ33esJAkqKQJ7euBxGbeWEzsS24uJREyzSUaSJt9MxH0lCu1xC vL7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=m2CGi4aqkiYSek1EBhlHsxPieNn6aVD4oDcH/dcNYS0=; b=ltEaPc6OVp2fB4+GOXKAhxwcvxXgOY0BeqX3WfjC9DNrp+U71Zp7+qALovJRlt4tp1 HZfeOUlafmL33HOrMNNG+6++U7P4K+k+mndDpFx2dX5FKa6nSJZLGlzCr392d/U4Z2Ii xbeU/ZkjfgZcmwVxv3UBaqIbZnZnAHRpCJmrglvlCfsIcfyEufw4fIfnw9Y2s2FedrZ5 oMtoULuGI2sFJw8WxWYJSKO31SMUbPoF0Lc+0RqTDpFNtvHXkraFbLkahpGfmVHGBd92 QUYM1OPlwRRZXXJ7uvCbg39lcseJ43qjzowqINRCuA+uAkjO6HeE8GGl89qW6H9/elLc yhgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MOqWT9Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8si14253396edz.31.2022.02.21.13.32.42; Mon, 21 Feb 2022 13:33:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MOqWT9Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231921AbiBUSqd (ORCPT + 99 others); Mon, 21 Feb 2022 13:46:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231893AbiBUSqZ (ORCPT ); Mon, 21 Feb 2022 13:46:25 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A0F195 for ; Mon, 21 Feb 2022 10:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645469161; x=1677005161; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=D+gbvhd+YzrBn/qP+Xn3UeOMt71YnVFf+SNtwwrBFDM=; b=MOqWT9Q/ewbiMRa4T2YMjXWxFi+GDTStm9OZYAbCv8HBgVKNXD2eWLvh PMqaoHEguMej+QK0/kYrIE51PP0F6CPR3f7Is/hly+sq6ue7+ZfpuwDpy GqfkgOsgbhFBszz4GXaKxnapadVSNjCdoZnutA55AX5JDsesK3iAKMFtd k7ifQIgam9FawJJFQq+vHgJDS7vkQ0fqV09Fal4r1XIDDdBvKw/LTVixe UqoYyUi82v/0Il7hjVxyoDX7LkH9YYsJbRRHDgw6bxv05JT6t6lH30U0O 8J3n5fpLUL7H+VN7pcmlJApXKPFrBXTiF08MqXhpG7PJGvq0atxnYnc96 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="314817976" X-IronPort-AV: E=Sophos;i="5.88,386,1635231600"; d="scan'208";a="314817976" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 10:46:01 -0800 X-IronPort-AV: E=Sophos;i="5.88,386,1635231600"; d="scan'208";a="547430782" Received: from abaydur-mobl1.ccr.corp.intel.com (HELO [10.249.228.66]) ([10.249.228.66]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 10:45:57 -0800 Message-ID: Date: Mon, 21 Feb 2022 21:45:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH core] perf data: Adding error message if perf_data__create_dir fails Content-Language: en-GB To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov References: <20220218152341.5197-1-alexey.v.bayduraev@linux.intel.com> <60253e6d-e8c5-550e-73b5-40720114c2a4@linux.intel.com> From: "Bayduraev, Alexey V" Organization: Intel Corporation In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.02.2022 21:24, Jiri Olsa wrote: > On Mon, Feb 21, 2022 at 04:24:28PM +0300, Bayduraev, Alexey V wrote: >> On 21.02.2022 1:43, Jiri Olsa wrote: >>> On Fri, Feb 18, 2022 at 06:23:40PM +0300, Alexey Bayduraev wrote: >>>> There is no notification about data directory creation failure. Add it. >>>> >>>> Signed-off-by: Alexey Bayduraev >>>> --- >>>> tools/perf/builtin-record.c | 4 +++- >>>> 1 file changed, 3 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c >>>> index 0bc6529814b2..0306d5911de2 100644 >>>> --- a/tools/perf/builtin-record.c >>>> +++ b/tools/perf/builtin-record.c >>>> @@ -1186,8 +1186,10 @@ static int record__mmap_evlist(struct record *rec, >>>> >>>> if (record__threads_enabled(rec)) { >>>> ret = perf_data__create_dir(&rec->data, evlist->core.nr_mmaps); >>>> - if (ret) >>>> + if (ret) { >>>> + pr_err("Failed to create data directory: %s\n", strerror(errno)); >>> >>> errno will be misleading in here, because perf_data__create_dir >>> calls other syscalls on error path >> >> Mostly I want to output something like: >> >> Failed to create data dir: Too many open files >> >> This will trigger the user to increase the open files limit. >> Would it be better to place such message to perf_data__create_dir after >> open() syscall? > > how about something like below (with your change) Looks better, I will apply this to my patch. Thanks, Alexey > > jirka > > > --- > diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c > index 15a4547d608e..d3382098d6f9 100644 > --- a/tools/perf/util/data.c > +++ b/tools/perf/util/data.c > @@ -52,8 +52,10 @@ int perf_data__create_dir(struct perf_data *data, int nr) > goto out_err; > > ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); > - if (ret < 0) > + if (ret < 0) { > + ret = -errno; > goto out_err; > + } > > file->fd = ret; > }