Received: by 10.213.65.68 with SMTP id h4csp865218imn; Wed, 14 Mar 2018 02:25:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELuTO0Oj0aOc0G4xrnI5qB2F4u27Cv9f0bQfMq342GVDmx37JiSnrn5aMG6nNp1FNpapiMQj X-Received: by 2002:a17:902:7401:: with SMTP id g1-v6mr3508537pll.4.1521019527633; Wed, 14 Mar 2018 02:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521019527; cv=none; d=google.com; s=arc-20160816; b=sTOVYhNR1oc5FtsRyQHh4Umdghg0ZIrSEHM+Rh6sL4wS4hBuSPaR7JEEuyWwMLvPil kDGuiz7ED/TAC14g1wmuHso3DBclYt/XNs/F2VCB+RnChFOL7NgQf7MVE7rPBCc1Nm/B IRYS2/G4tccAytL6YpwbAXkmA0iXyO5T584s/Nvv4E5nR7tEQtPKy9iP7XlBWewXMyP7 kh8KC+b1qFiF3a7i5wApBmaiNim9iLo9m9Vtf4wReQOtFLzWbAzWhTzGk9OZ2CKMKxF/ WDvwqaZbAq2e2VtaewS4qlQ3TTnQujmychrEraLFC7/YokBq/uREZ5/R3Num0KoPv7yL shdg== 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=51VtyN7n3nJMJXT4eGRuefz7WY/0tNP40mM3RFu9EXs=; b=s91KmWqgarq9nVKa7SjyCPy6XNRivVIiLr4fDdgaPIZpGZNkMx6YA7Qu6B6BDCcc5y 08Qh8go3BC0nJgdTv5Ei+SVVU4TUbYi/S4scVK+k4LxpTX9mEG1BH0c15+kncIv8q1dY 1T4uDD6ZQOpNns57bse42H4vx30CGL6yX0k+7fTF8e8uHLxywoD/njQsAS8h+a6Ubz5d zRechQcODMyI0aKudrLQt3Aguocue4cWr8Jtxp5bYCS+ZshHep6jM6o5Bqe5L7RwPdfp NydbWCq21/MsSKw0DgYzEg6w5pOI5vjAMSOqVnlrtTMsO/6cRr6MxnIlHIW+aa5doOkH h0PA== 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 f5-v6si1673067plr.243.2018.03.14.02.25.13; Wed, 14 Mar 2018 02:25:27 -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 S1752429AbeCNJXs (ORCPT + 99 others); Wed, 14 Mar 2018 05:23:48 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6199 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752406AbeCNJXr (ORCPT ); Wed, 14 Mar 2018 05:23:47 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D5807E3EBD300; Wed, 14 Mar 2018 17:23:32 +0800 (CST) Received: from [127.0.0.1] (10.47.81.87) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Wed, 14 Mar 2018 17:23: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> <543acf58-520d-e3e2-211e-17068d713a4f@huawei.com> <20180313211837.GC29120@us.ibm.com> <603efe46-6b79-3066-751e-696502eaef3f@huawei.com> CC: Arnaldo Carvalho de Melo , , Michael Ellerman , "Jiri Olsa" From: John Garry Message-ID: <6ade080f-e12f-5db3-940e-c7df309311c1@huawei.com> Date: Wed, 14 Mar 2018 09:23: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: <603efe46-6b79-3066-751e-696502eaef3f@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.81.87] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/03/2018 07:10, John Garry wrote: > On 13/03/2018 21:18, Sukadev Bhattiprolu wrote: >> John Garry [john.garry@huawei.com] wrote: >>> On 13/03/2018 20:10, Sukadev Bhattiprolu wrote: >>> >>>> 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? >> >> In the current code and with DT_UNKNOWN, is_leaf_dir() returns false when >> it sees the "." or ".." entries right? In the new code, we skip those and >> return false only if we find some other directory. >> > > OK, that's the real issue, being the "." and ".." entries. > > @Arnaldo, I'll try to send a fix for this today. I just need to make an > xfs to test. Sorry for the hassle. > Hi Sukadev, Even with the xfs I have created I still don't see DT_UNKNOWN. So can you kindly test this change for me: diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 1c018445e757..9f712dafa0b2 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -873,7 +873,10 @@ 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] != '.') { + if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) + continue; + + if (dir->d_type == DT_DIR) { res = 0; break; } else if (dir->d_type == DT_UNKNOWN) { It's quite similar to your change, except keeping the check for DT_DIR. Much appreciated, John > John > >> Thanks, >> >> Sukadev >> >> >> >