Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp712803pxf; Thu, 1 Apr 2021 11:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyv1AtRq9ZDqglMA+L8SH5VJGW6snPtY6X/MGPyUnNja9GTap0uWYWHwzymxmLyw37xv4iw X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr10360442ejc.403.1617301956228; Thu, 01 Apr 2021 11:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617301956; cv=none; d=google.com; s=arc-20160816; b=XqJIej3lReYLXNHPFg1RlDCNHqZO98xHr1426cfXsedcRd1P3/CmgENoZTuZjDXnYV PRsdfhLIHeM+1Jj6Uhp66mCL/5fe7GqpZh4M7LzRxW/DqZfQ1ov1T1qdYs3GFvv73S09 +2TJETKhIlJBlXBc68YEvXnhb+KfGt7T8hx5iLD7282cw0ButWvgAsyufWonWLI+YDt7 1m9ItA2J5jcmOkR7dzB7LZptH2qYNv8QdMpVu6jR2Ite1Ycs2q64G8O5jHVsBI1QM/8n U0bGZ+eTzl57hOCj0GXCh0aFsmJeQfU/0tkpfmYsDSl12KcQ0M2L+OvkGZjsTprkC2+b ixdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mHI3kK2l6R6bQkNsYRKDg5GNKOb/0mlH0MNoRlrgvFY=; b=hYLzGADK+mBTYYZrDTl3P8q2Cj8p90r+5rSoXWHbI82Yl4onJGKXduGEGHLTjBHOQO s0dP974K3uTuf8YQ4xNLsEDVcson26TFnpLLhOfAdwMFbwcHUnzv9c/O1xR1n2E8Tm+O MrWbc2XGHIRZJoLHgCDyJDbfbJ181evLUoHocM0yaWxJSQgYd5D+6xuK3//0gBtUH2AF 6maZgAJf5C42wMmqHi4z70hW2cRSwHil9ST9HqcTOJ2Ps4Ym/KpFs8G3tP2gPwfMX1eg T1+FGjYp34OSSaa0biqDyjQkPCn0LzUT/l9a5uQ/w3o12AtJHCEmobPrGqqDqvUoQorB gfaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HnzGmHoH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si5184647ejx.201.2021.04.01.11.32.13; Thu, 01 Apr 2021 11:32:36 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HnzGmHoH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240235AbhDAS3t (ORCPT + 99 others); Thu, 1 Apr 2021 14:29:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27477 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234925AbhDASHO (ORCPT ); Thu, 1 Apr 2021 14:07:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617300433; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mHI3kK2l6R6bQkNsYRKDg5GNKOb/0mlH0MNoRlrgvFY=; b=HnzGmHoHVe2IVLfCQ5l3llEu7VeHKIGZoSRbzWVhPA+iJHfp1TF3vJyyHnBWoGTOGOZz4D 1wJ2CqmyQS1RINgUXiKxoBoTthTZf7ATgxb5u51RzI6YXVMXA99ANWNTlOHjVNuBFIwcTZ tDO2y+muFKt6ZDtXv9vGEW4CdOCbyDI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-lqWGGEMbOT-RQvZJrvyUbQ-1; Thu, 01 Apr 2021 10:05:31 -0400 X-MC-Unique: lqWGGEMbOT-RQvZJrvyUbQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB0AD81633; Thu, 1 Apr 2021 14:05:14 +0000 (UTC) Received: from krava (unknown [10.40.193.98]) by smtp.corp.redhat.com (Postfix) with SMTP id 15F917217B; Thu, 1 Apr 2021 14:05:13 +0000 (UTC) Date: Thu, 1 Apr 2021 16:05:13 +0200 From: Jiri Olsa To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf inject: Fix repipe usage Message-ID: References: <20210401103605.9000-1-adrian.hunter@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210401103605.9000-1-adrian.hunter@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 01, 2021 at 01:36:05PM +0300, Adrian Hunter wrote: > Since commit 14d3d5405253 ("perf session: Try to read pipe data from file") > perf inject has started printing "PERFILE2h" when not processing pipes. > > The commit exposed perf to the possiblity that the input is not a pipe but > the 'repipe' parameter gets used. That causes the printing because perf > inject sets 'repipe' to true always. > > The 'repipe' parameter of perf_session__new() is used by 2 functions: > - perf_file_header__read_pipe() > - trace_report() > In both cases, the functions copy data to STDOUT_FILENO when 'repipe' is > true. > > Fix by setting 'repipe' to true only if the output is a pipe. > > Fixes: e558a5bd8b74 ("perf inject: Work with files") > Signed-off-by: Adrian Hunter Acked-by: Jiri Olsa thanks, jirka > --- > tools/perf/builtin-inject.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c > index 6fe44d97fde5..ddccc0eb7390 100644 > --- a/tools/perf/builtin-inject.c > +++ b/tools/perf/builtin-inject.c > @@ -906,7 +906,7 @@ int cmd_inject(int argc, const char **argv) > } > > data.path = inject.input_name; > - inject.session = perf_session__new(&data, true, &inject.tool); > + inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool); > if (IS_ERR(inject.session)) > return PTR_ERR(inject.session); > > -- > 2.17.1 >