Received: by 10.213.65.68 with SMTP id h4csp582972imn; Tue, 13 Mar 2018 13:54:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELvz3G57RtR6vyxGPAy3XH3g1y2qmaLF/iuBIgD+KsqWU1pyPFpmfTT0J8Q1mWYbDKurL9E7 X-Received: by 10.101.89.65 with SMTP id g1mr1562422pgu.185.1520974482313; Tue, 13 Mar 2018 13:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520974482; cv=none; d=google.com; s=arc-20160816; b=kK+E3oVGagY/vjNgakndjGDEUK7uij8dwCFNoZRXDBTF3KqUQ4sK5QNlK3HVb+/O9D 6Jowxe1wRBhHuWLh3Nr8dQ1x7vGUdf69UUOBx3kEZe93w6LhDSZRmlPp3bbjB5Ov/hed Q71geVxhT+N+6Asgzf0kKmmt735T3aKNwECxGlZWeZVz0YRrXq4Lnv1Xg45ZI8koN+Q2 Bgh2e03GauMY/1K6/75TTc7ECH1gnTtNlJ6+pV7F3Ox9s1zq3eaWa6ZziAVT0rFEYgYz /MjEpg5n9mDPfOLGLLSZ7AW/aoijYtO4Jt86sLkjCgmbTwOsYNQwJ7yfbGSz5u5/Ntk4 10XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=4QA28f5Najc27VKXy++e+LSeRcs1rQGxA82Fy6I3s/g=; b=FtCiXrjuWuo5028F/h62MhBo1b+ooG1ig+flGTl/XpqJ1UFmGpTlrjVv5ngL1l8IyH iL0uA72cBZEDDiMGwkKdRkEi24OqiRmuANyG/lt6v4udMfvWlgMbsf8lWZJY2b7lnIcM QbthW+UrfyctJ35OeKgM/jnOHmI1lW+FuUAR+IKYn2FizOhc+X8muEBHpwMDQS7zf7uw wJUWoVA7FKSbRj0Y/CBdihv0eLowbbEYhLifUU5CaNBhI+KYBXk26Cn8lH+SPljWpbgZ mn2GlJxoXi9QTah/NGFtJ2oZfZNbOJZT6j3rTyKfZuhSNk00hCSrSqKpPU/L/k2dtGAn crZg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si723704pli.25.2018.03.13.13.54.27; Tue, 13 Mar 2018 13:54:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076AbeCMUxg (ORCPT + 99 others); Tue, 13 Mar 2018 16:53:36 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53047 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752871AbeCMUxf (ORCPT ); Tue, 13 Mar 2018 16:53:35 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CED2C7CD89B89; Wed, 14 Mar 2018 04:53:31 +0800 (CST) Received: from [127.0.0.1] (10.47.91.115) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Wed, 14 Mar 2018 04:53:32 +0800 Subject: Re: perf-core build fails on powerpc To: Sukadev Bhattiprolu References: <20180313191742.GA29120@us.ibm.com> <152d2ba4-fe57-beab-87d5-554a0fede9ae@huawei.com> <20180313201003.GB29120@us.ibm.com> CC: Arnaldo Carvalho de Melo , , Michael Ellerman , "Jiri Olsa" From: John Garry Message-ID: <543acf58-520d-e3e2-211e-17068d713a4f@huawei.com> Date: Tue, 13 Mar 2018 20:53:27 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20180313201003.GB29120@us.ibm.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.91.115] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/03/2018 20:10, Sukadev Bhattiprolu wrote: + > John Garry [john.garry@huawei.com] wrote: >> On 13/03/2018 19:17, Sukadev Bhattiprolu wrote: >>> >>> >>> Building perf on Powerpc seems broken when using Arnaldo's perf/core branch >>> with HEAD as: >>> >>> 1b442ed ("perf test: Fix exit code for record+probe_libc_inet_pton.sh") >>> >>> It maybe related to this commit: >>> >>> commit d596299 >>> Author: John Garry >>> Date: Thu Mar 8 18:58:29 2018 +0800 >>> >>> perf vendor events: Add support for pmu events vendor subdirectory >>> >>> Reverting this hunk from tools/perf/pmu-events/jevents.c, seems to fix the >>> problem for me. >>> > > Hi John, > > I have an xfs file system which seems to have d_type == DT_UNKNOWN for all > entries in 'tools/perf/pmu-events/arch/power8'! readdir(3) says ->d_type > may not be supported by all file systems. > > Not relying on ->d_type seems to fix it: > Hi Sukadev, Thanks for debugging this. Jiri Olsa (cc'ed) warned me on this, so I did add the check for d_type == DT_UNKNOWN. But, if all files have d_type == DT_UNKNOWN, you're code would from visual observation look to be same as mine (apart from check for '.' or '..' filename, which I would say is already covered by stat() and S_ISDIR()). Or is d_type value just unreliable? Much appreciated, John > @@ -873,26 +879,26 @@ static int is_leaf_dir(const char *fpath) > return 0; > > while ((dir = readdir(d)) != NULL) { > - if (dir->d_type == DT_DIR && dir->d_name[0] != '.') { > - res = 0; > - break; > - } else if (dir->d_type == DT_UNKNOWN) { > - char path[PATH_MAX]; > - struct stat st; > + char path[PATH_MAX]; > + struct stat st; > > - sprintf(path, "%s/%s", fpath, dir->d_name); > - if (stat(path, &st)) > - break; > + if (strcmp(dir->d_name, ".") == 0 || > + strcmp(dir->d_name, "..") == 0) > + continue; > > - if (S_ISDIR(st.st_mode)) { > - res = 0; > - break; > - } > + sprintf(path, "%s/%s", fpath, dir->d_name); > + if (stat(path, &st)) > + break; > + > + if (S_ISDIR(st.st_mode)) { > + res = 0; > + break; > > >