Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2148824pxb; Fri, 8 Oct 2021 01:44:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB7rcDgjOikQfVzDYlYNCoY2eAlf4JQVNid5Y6LLCj7iUPZKIfK0/iXyE6Eod/+OAMkGNr X-Received: by 2002:a05:6a00:234f:b0:3eb:3ffd:6da2 with SMTP id j15-20020a056a00234f00b003eb3ffd6da2mr9074722pfj.15.1633682682685; Fri, 08 Oct 2021 01:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633682682; cv=none; d=google.com; s=arc-20160816; b=ItLFWSfnzRoSVmyWEaUl+QYktuL+lEj7Xx2UiD2z5NY8KVjiKGNEWEh//NjoKO9m7e I6Tdfj2YpO01uzcW97jLtHJxwMNd9EQ2eXrDVDpr0j2twEpBlljYP3pWA6CsYYGLH9hs gp8Fd5AMqbZnPCBRzU9oRdGnCRYkj+SyZapsbMUDbKEkPdr2Zy58ythfqEBI1e7riCeQ UU5lE34cjme90XH48JpX6ZFLCW+L/XqMnhUF2Xh67lHmrV9bdvH37GBNCBqWi+bFzKYe xQHFw9B2iUDPEJoJUtnaOrGE2dQ6jxyiUddPzS+J0MOAFQvbgOzBTB9CELsASlt4rGrT 6iEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=StRHSyLcheOZP8Ub3eNZe2ZM00ijsFwEHiimQRp+URc=; b=ynhjEzFEZWzzcQmZlXRaige6AWK2hsVcD5DX4fdrclrN7jDmPmagh0eC/cc+Gp/GnV YMSb3sv7jtYcdZgKl7cgtlFpts5ybNUvsgH3K9ru/o/Nx3O3RhZsmBQGOxsuR0tMlDh7 TI8uN/luVLruRe8+mSn1aHH3NOuV1hPlmaQrfyNpuIQRQlyhZLsIG6YxzcS7eyabyCmD iYbIsTMg9uoZXKjTEYreVqj5u73X31Yh4nQREhamuqYpkoGu7H92Hqzm8rpVDn0qtllS 8MOS4hCglAVjYHgOpUkx4u0PWEaRE9PeNO0k3n95981n2BNze+feODxf4gtomYx5oXVJ YmDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r7si2576887pjp.186.2021.10.08.01.44.29; Fri, 08 Oct 2021 01:44:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232350AbhJHIok (ORCPT + 99 others); Fri, 8 Oct 2021 04:44:40 -0400 Received: from mga03.intel.com ([134.134.136.65]:29466 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbhJHIok (ORCPT ); Fri, 8 Oct 2021 04:44:40 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="226416478" X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="scan'208";a="226416478" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 01:42:45 -0700 X-IronPort-AV: E=Sophos;i="5.85,357,1624345200"; d="scan'208";a="489376509" Received: from abaydur-mobl1.ccr.corp.intel.com (HELO [10.249.227.14]) ([10.249.227.14]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 01:42:41 -0700 Subject: Re: [PATCH v3 6/8] perf session: Move event read code to separate function To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini References: <6ab47325fa261deca4ca55ecacf1ca2437abcd78.1633596227.git.alexey.v.bayduraev@linux.intel.com> From: "Bayduraev, Alexey V" Organization: Intel Corporation Message-ID: Date: Fri, 8 Oct 2021 11:42:18 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.10.2021 10:33, Jiri Olsa wrote: > On Thu, Oct 07, 2021 at 01:25:41PM +0300, Alexey Bayduraev wrote: > > SNIP > >> static int >> -reader__process_events(struct reader *rd, struct perf_session *session, >> - struct ui_progress *prog) >> +reader__read_event(struct reader *rd, struct perf_session *session, >> + struct ui_progress *prog) >> { >> u64 size; >> int err = 0; >> union perf_event *event; >> s64 skip; >> >> - err = reader__init(rd, &session->one_mmap); >> - if (err) >> - goto out; >> - >> -remap: >> - err = reader__mmap(rd, session); >> - if (err) >> - goto out; >> - >> -more: >> event = fetch_mmaped_event(rd->head, rd->mmap_size, rd->mmap_cur, >> session->header.needs_swap); >> if (IS_ERR(event)) >> return PTR_ERR(event); >> >> if (!event) >> - goto remap; >> + return 1; >> >> session->active_decomp = &rd->decomp_data; >> size = event->header.size; >> @@ -2311,6 +2301,33 @@ reader__process_events(struct reader *rd, struct perf_session *session, >> >> ui_progress__update(prog, size); >> >> +out: >> + session->active_decomp = &session->decomp_data; >> + return err; >> +} >> + >> +static int >> +reader__process_events(struct reader *rd, struct perf_session *session, >> + struct ui_progress *prog) >> +{ >> + int err; >> + >> + err = reader__init(rd, &session->one_mmap); >> + if (err) >> + goto out; >> + >> +remap: >> + err = reader__mmap(rd, session); >> + if (err) >> + goto out; >> + >> +more: >> + err = reader__read_event(rd, session, prog); >> + if (err < 0) >> + goto out; >> + else if (err == 1) >> + goto remap; >> + >> if (session_done()) >> goto out; >> >> @@ -2318,7 +2335,6 @@ reader__process_events(struct reader *rd, struct perf_session *session, >> goto more; >> >> out: >> - session->active_decomp = &session->decomp_data; > > active_decomp should be set/unset within reader__process_events, > not just for single event read, right? No, it should be set before perf_session__process_event/process_decomp_events and unset after these calls. So active_decomp setting/unsetting is moved in this patch to the reader__read_event function. This is necessary for multiple trace reader because it could call reader__read_event in round-robin manner. Regards, Alexey > > jirka > >> return err; >> } >> >> -- >> 2.19.0 >> >