Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3441972yba; Tue, 16 Apr 2019 11:22:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBhngPSL2cbJHO3XbQO56/VE3A+eH0fKOq5ya8VJxpAXeZAnsSZUzMSVpy2WLZ1YAh6LvW X-Received: by 2002:aa7:9888:: with SMTP id r8mr30252569pfl.116.1555438959886; Tue, 16 Apr 2019 11:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555438959; cv=none; d=google.com; s=arc-20160816; b=scrX0SmJ3Gz7yOHlyB89EAn5JS4uhLvu+8QJa5qztpJiNCaJJYKb9dLhfStPysmwTy DhIDkNI/RyUwVYoDS/OxevHxBbZeYLoO0I2EJ98I6pot3zp4IU8mTNKsfnCO+ddJhG4c cwejlhQzSLEHhIyH/1ejSDdU2bThqV2UdoekmYqEdm7cOiRkTtkr9VoFRyfXfwmgduia /TFMmOYv9Pmxn+dNT0vnDyNimJPgmQh6caZp77nkLgwTZeP3cKulvHdrqbDE6Rq8OYvk L0hvNGdQqKW3s8XZNfj6vPOqUq2giJEEdDFW8c4i4MN+JTCykSXqdnYd8TDU3u+Ntu5x iH0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6QZ8IHYkFXJk/I0vneJo5V3+4qiiyltBs/Bd8XdaZQ0=; b=VaW1WDbJlLQpHk2pY0onUlAwKPLKp/5cVKKljFEtNObpkGoC+rLIkX9PMdnMs/6+KA CSuUlMO8qEFf3zG/IQcRuJiOpavpBLX3ZTtKRjt+z/Ck+udFlST6LOnzmN9d4GpF1T9a RvCyPFmKBKJnThYZisaZfuDc+9L06LBgnvvRgwemB38OidXcgL9Ilg14yN1YQJvspV0i OfgyfSjLdZ5NCyikA5fBYD1gwcYNhH1NfkugdMJVvj+6fhAdq+9jWqkPtyPyVp92oABz x+qF2rxmNG+TlKqD7cJJAzxuBYFMgrlbCuow6Nub+KHaKE/AAoDdyAl70S4vL11uKt+I gjbw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si25705157pgk.424.2019.04.16.11.22.23; Tue, 16 Apr 2019 11:22:39 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729383AbfDPSVp (ORCPT + 99 others); Tue, 16 Apr 2019 14:21:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58376 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfDPSVo (ORCPT ); Tue, 16 Apr 2019 14:21:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC539F74B3; Tue, 16 Apr 2019 18:21:43 +0000 (UTC) Received: from krava (ovpn-204-66.brq.redhat.com [10.40.204.66]) by smtp.corp.redhat.com (Postfix) with SMTP id 2AE7D19C71; Tue, 16 Apr 2019 18:21:39 +0000 (UTC) Date: Tue, 16 Apr 2019 20:21:39 +0200 From: Jiri Olsa To: Stanislav Fomichev Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Adrian Hunter , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [PATCH 02/12] perf tools: Separate generic code in dso_cache__read Message-ID: <20190416182139.GC10125@krava> References: <20190416160127.30203-1-jolsa@kernel.org> <20190416160127.30203-3-jolsa@kernel.org> <20190416171712.GB8631@mini-arch.hsd1.ca.comcast.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190416171712.GB8631@mini-arch.hsd1.ca.comcast.net> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 16 Apr 2019 18:21:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 16, 2019 at 10:17:13AM -0700, Stanislav Fomichev wrote: > On 04/16, Jiri Olsa wrote: > > Moving file specific code in dso_cache__read function > > into separate file_read function. I'll add bpf specific > > code in following patches. > > > > Link: http://lkml.kernel.org/n/tip-7f7d717uzrqt5ka2xp29ige3@git.kernel.org > > Signed-off-by: Jiri Olsa > > --- > > tools/perf/util/dso.c | 47 ++++++++++++++++++++++++------------------- > > 1 file changed, 26 insertions(+), 21 deletions(-) > > > > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c > > index cb6199c1390a..6baad22ec8a9 100644 > > --- a/tools/perf/util/dso.c > > +++ b/tools/perf/util/dso.c > > @@ -794,6 +794,30 @@ dso_cache__memcpy(struct dso_cache *cache, u64 offset, > > return cache_size; > > } > > > > +static ssize_t file_read(struct dso *dso, struct machine *machine, > > + u64 offset, char *data) > > +{ > > + ssize_t ret; > > + > > + pthread_mutex_lock(&dso__data_open_lock); > > + > > + /* > > + * dso->data.fd might be closed if other thread opened another > > + * file (dso) due to open file limit (RLIMIT_NOFILE). > > + */ > > + try_to_open_dso(dso, machine); > > + > > + if (dso->data.fd < 0) { > > + dso->data.status = DSO_DATA_STATUS_ERROR; > pthread_mutex_unlock(&dso__data_open_lock) here? oops, yea.. thanks jirka