Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4730923ybc; Fri, 15 Nov 2019 09:11:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyLVsw8fCILFt0R9QgYzYwRpbR82osh0GaKs96o6OJKjEJ3XTAjIj7B24ZMKfWEn6/MQeRV X-Received: by 2002:a17:906:12d3:: with SMTP id l19mr2181325ejb.165.1573837869982; Fri, 15 Nov 2019 09:11:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573837869; cv=none; d=google.com; s=arc-20160816; b=nGSgwUzPg+aD6d0PgeOiCqLT4G5BPlDWxG8lQ+p+oA+kI6WJeqnJpnKYyHOSkAXzMa tNwQpBRn3HRiXwzmas4pBTH+YX9IFdH5z1/lrk65JVXB6tt8kaPxcRB+GiHm1EOFSeUN sm6x4DRzLAYkmf9NzJDtCnHwh74hqnjlIPnkbQtUNarCFxFozy/J0wXZmtpU8Yeo94K+ PaHf5s7dSbW5rq5gR5sObNi8yMAjgxH5KpoI6hU0M4X7SlgSgTGpznfWp595f0n16KoQ myUxSt9DlVHm8lmq/nc+AgrGshc/VhMovdhpn/OWeNUwQuKV5FCvsVCaoI5dXle2kDLK RFMw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=0dJiTHMx39U+Q73Uzft0sEYxTHZsLT3z7TMZaZSfY08=; b=Dag8bpnvPt7zgxkQsx3iweOw2dHYO2kF+swCyCW9CTXvVwq+PAIA3vH++SoGZdWJqb Tg5hLcYvbFQ3dMHbD+Dc94iSO5TWcbajDzhOEaqSQL+e8F6zaZYbkb8DnpDu1bTNArov HKpxnX+6YLzT4orRp+6N66ED4LPV5mzmDbDddNOb72TvwwMnwQfZ64500r3DMQbYtULF BHEaErtGmf176yyhpf0ugZuxkmi12Y2bSMWR6cjlTpZdUqOoAmJgy5HjQ2DIXh6il+P3 z/bIUb5+qbsH8dXgd8okjTu85BJy8yU2NbhI1jXg4xKFJ/utg4ZxK4hjlhpI+l/q7yTn veXw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16si4747493ejc.277.2019.11.15.09.10.44; Fri, 15 Nov 2019 09:11:09 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727589AbfKORJZ (ORCPT + 99 others); Fri, 15 Nov 2019 12:09:25 -0500 Received: from mga04.intel.com ([192.55.52.120]:12258 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbfKORJY (ORCPT ); Fri, 15 Nov 2019 12:09:24 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Nov 2019 09:09:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,308,1569308400"; d="scan'208";a="288608552" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 15 Nov 2019 09:09:23 -0800 Received: from [10.252.8.77] (abudanko-mobl.ccr.corp.intel.com [10.252.8.77]) by linux.intel.com (Postfix) with ESMTP id 6E48F5803E3; Fri, 15 Nov 2019 09:09:21 -0800 (PST) Subject: Re: [PATCH v1] perf session: fix decompression of PERF_RECORD_COMPRESSED records To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Peter Zijlstra , Alexander Shishkin , Ingo Molnar , Andi Kleen , linux-kernel References: <237222f1-9765-dce1-601c-60530a7fc844@linux.intel.com> <20191115151124.GA25246@krava> From: Alexey Budankov Organization: Intel Corp. Message-ID: <2f2b2421-6865-4669-7e30-918d12ae5e01@linux.intel.com> Date: Fri, 15 Nov 2019 20:09:19 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191115151124.GA25246@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.11.2019 18:11, Jiri Olsa wrote: > On Fri, Nov 15, 2019 at 12:05:14PM +0300, Alexey Budankov wrote: >> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c >> index f07b8ecb91bc..3f6f812ec4ed 100644 >> --- a/tools/perf/util/session.c >> +++ b/tools/perf/util/session.c >> @@ -1957,9 +1957,31 @@ static int __perf_session__process_pipe_events(struct perf_session *session) >> return err; >> } >> >> +static union perf_event * >> +prefetch_event(char *buf, u64 head, size_t mmap_size, >> + bool needs_swap, union perf_event *ret); > > why not move prefetch_event definition in here? > I don't see any need for the static declaration.. It is just for the sake of more readable patch formatting and, yes, could be avoided and replaced by the definition. > >> + >> static union perf_event * >> fetch_mmaped_event(struct perf_session *session, >> u64 head, size_t mmap_size, char *buf) >> +{ >> + return prefetch_event(buf, head, mmap_size, >> + session->header.needs_swap, >> + ERR_PTR(-EINVAL)); >> +} >> + >> +static union perf_event * >> +fetch_decomp_event(struct perf_session *session, >> + u64 head, size_t mmap_size, char *buf) >> +{ > > if this is decomp specific, it could take 'struct decomp*' as argument Well, it makes sense. whole session object is not required here. Just session->header.needs_swap could be passed as a param. Shall we make it like this? static union perf_event * fetch_decomp_event(u64 head, size_t mmap_size, char *buf, bool needs_swap) > >> + return prefetch_event(buf, head, mmap_size, >> + session->header.needs_swap, >> + NULL); >> +} >> + >> +static union perf_event * >> +prefetch_event(char *buf, u64 head, size_t mmap_size, >> + bool needs_swap, union perf_event *ret) >> { > > 'error' might be more suitable then ret in here Accepted for v2. ~Alexey > > thanks, > jirka > >