From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49E46240220 for ; Mon, 13 Jan 2025 15:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736781594; cv=none; b=E8h2jCxlnF3ST1GS+e91u9o8h+vC3huLINfOdsNCGpViVRuafu0MAQuLnjTW23KmN6L4ZYHswWrdmRQc5+5xsWyWPUZFrnI0YTN4K6tdiGiXPVoZy7itq+ExKVCOnfx4109W2L6DTC6Ddy6c7lLElys3UYw8wbCp/ep3zJQpkJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736781594; c=relaxed/simple; bh=wpBUo0e7dn7YAhx9HXJYJyFpbI2TZVFrNf0vcogHcPM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CU76SjIM5jsjYFjDdjCbqSzv/gE/H6lkFSb7doUhWmJaAa7S0Ze0O8zr5zCVpEO7in9lPxz0x/FpeYA/72TvNDJi76VaiI0u6mPbWz3cr1tJ+ipLp+tpEVpkP7uVe41ox5Fcrj48t1jG8BzkpCqP87Gt4FryrFddykroQsqIBE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wGSe7rEQ; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wGSe7rEQ" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso42637885e9.0 for ; Mon, 13 Jan 2025 07:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736781590; x=1737386390; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=cVenH7nswJordeMtcUBKf5eyxS1L8wsCNNzck2rItTQ=; b=wGSe7rEQH1yVBxUIQlIlv9RYeOpOFupoL8UvUZVl03wtguRdw7fmwFSGlzNli+s0dw TVmBb/GzCpj+Gc+dCus3enal/4fot01JeRfnNojH7KuMv9oQQ9geC2Qv3gqCehufbZ1P 7lbb3Vr+RfjH7e2ouBljkTxWaN2NknyFdG54ZJQW+7CKLrLvfHoyIxnvPTWsjhNT6rGD leDQVhHZWwKQKZUDnaN0E93dFJARpKg6n97CH+GgsrlnK5ne1i/vaxtIRg11CmXt2oBC 49021AEPbBNDJSCoTNw+77TMsQcM+i9cGA5TtYuYXdsfOK2jhDoA4KJ0U795oaWbYYfa gBqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736781590; x=1737386390; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cVenH7nswJordeMtcUBKf5eyxS1L8wsCNNzck2rItTQ=; b=WhxQ/5rUI4j1LqbrQ4dj7+4KDAy9oqvWT7PeUrM3qnwk1ErZRqEzPtc0GzkOk8cxEB qFXRYSZuzBtAqSEWy+b+XjDeZ+hMmPUdM4C2B5homzWdizJcIfHmIEdCMhndfkF77Rkh yFd/H7Q5XBqK1ZI11lmcCXf4kFR3FRUglL85p8+gqCxK56Oy000hFBd14mjA21Hn/QdH tyWb344o26oSqQeo/eQziuuNI876pAsOIap5KyMDmO9qfnOwuVsuYAOzTNjVgpIHmRAA i/jUzIucAwUXTzfiG7m7I6yle68W8sXSfBluWMlnn8olou3Qu2R5Mtz8Wvc9HyZtVO+o zrCg== X-Forwarded-Encrypted: i=1; AJvYcCUfe9Mi/1l3Nq8xwoA084zNJpshJvWy/329eLhknyCOfaFU02beGw85TvXFz2whSftvFT2wisFMn2X+S6o=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0CPkb6eYkydhtrlrA9ubqdw5N4Fy5En3hhuVByq2N9yS7QPqB Rc2XbeX4lZMN6+Yy9WuWL8JyOJuTTy46q+EAk7uSXLgdRIL+I06DVBs28AQC5Ok= X-Gm-Gg: ASbGncsL1bXgkuLR3AedMxB+4mddM/M9yNmSCFsTfkJFCM7Tba6Bgni5CaI1eplEhnc VInYws6GyB+Jv5L5M988vNz8r0eyTT3mPjSeBcCbTwW8cvD07WiWPgg6/fKnvGOciAApGuGrN34 mXai3s4AKKiYTRpql5Pni5RLqcek/a6SxPQBgeZ9TaLNALVVRpsAGIJRjw12gdBmGJtRuh7aiW0 k6u9qf2nTRiFVu1Zzi0tpmgLu8tKodOpzsrl09b0KTeCgHidf7q1JsEGGkdYtVrOVgs X-Google-Smtp-Source: AGHT+IHYO6rBWxot0WjCrgOIXoLf7Hb6Vaz9FC4ZRGTO+KwdByGhDjWfQU1esAzSwfVJV0nnQldhIg== X-Received: by 2002:a05:600c:5246:b0:434:feb1:adbb with SMTP id 5b1f17b1804b1-436e271d5d6mr196307345e9.31.1736781590527; Mon, 13 Jan 2025 07:19:50 -0800 (PST) Received: from [192.168.68.163] ([212.105.145.205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436e2da6401sm182484945e9.2.2025.01.13.07.19.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jan 2025 07:19:49 -0800 (PST) Message-ID: <20d97acb-bcf8-481e-a898-a13580c566b0@linaro.org> Date: Mon, 13 Jan 2025 15:19:49 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf report: Fix input reload/switch functionality To: Dmitry Vyukov Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, irogers@google.com References: <20250108063628.215577-1-dvyukov@google.com> <384d6c4b-d2ce-47f8-9030-6225758b5923@linaro.org> <89e678bc-f0af-4929-a8a6-a2666f1294a4@linaro.org> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/01/2025 12:19 pm, Dmitry Vyukov wrote: > On Thu, 9 Jan 2025 at 15:50, James Clark wrote: >> On 08/01/2025 3:35 pm, Dmitry Vyukov wrote: >>> On Wed, 8 Jan 2025 at 16:23, James Clark wrote: >>>> >>>> On 08/01/2025 6:36 am, Dmitry Vyukov wrote: >>>>> Currently the code checks that there is no "ipc" in the sort order >>>>> and add an ipc string. This will always error out on the second pass >>>>> after input reload/switch, since the sort order already contains "ipc". >>>>> Do the ipc check/fixup only on the first pass. >>>>> >>>> >>>> Hi Dmitry, >>>> >>>> A reproducer with before and after behavior might be helpful for the review. >>>> >>>> It might be unrelated to your change here, but the input switch thing >>>> didn't seem to do anything for me. If I record two files, open the first >>>> one, press S and select the second file nothing seems to change. I >>>> assumed it would show the other file but nothing changes? >>>> >>>> $ perf record -- true >>>> $ perf record -o 2.data -- ls >>>> $ perf report >>>> S key >>>> load 2.data >>> >>> Yes, sure. This needs "--sort symbol": >>> >>> perf report --sort symbol >>> >>> then press 's', select file, and it terminates. >>> >>> Affects fewer cases then I initially assumed, since I happened to run >>> with "--sort symbol" when I discovered it. >>> >>> >> >> Ah yeah I can reproduce the bug with --sort, which is fixed by the >> patch. But 's' doesn't actually reload a new histogram for me, I just >> get the original file again. Maybe I'm misunderstanding what 's' is >> supposed to do? > > As far as I understand, 's' allows you to select and load a new > profile w/o existing (fwiw, if you select a different file). If the By 'without existing' do you mean running perf report with no perf.data file? It won't run like that it just says "failed to open perf.data" > file has changed, I guess you can also reload it and see the changes. > I wasn't able to make that work. How do you reload? If I change screen between different events I still get the old file and I didn't see 'reload' mentioned in the keybinding popup. I suppose my point is maybe it's not worth fixing the sort order bug if we can just remove input file switching. The behavior doesn't seem any different to v5.8 in case its a regression. Maybe I'm just doing something wrong though. > >>>>> Signed-off-by: Dmitry Vyukov >>>>> Fixes: ec6ae74fe8f0 ("perf report: Display average IPC and IPC coverage per symbol") >>>> > Cc: Namhyung Kim > Cc: Ian Rogers >>>> >>>>> Cc: linux-perf-users@vger.kernel.org >>>>> Cc: linux-kernel@vger.kernel.org >>>>> --- >>>>> tools/perf/builtin-report.c | 30 ++++++++++++++++-------------- >>>>> 1 file changed, 16 insertions(+), 14 deletions(-) >>>>> >>>>> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c >>>>> index 048c91960ba91..42d7dfdf07d9b 100644 >>>>> --- a/tools/perf/builtin-report.c >>>>> +++ b/tools/perf/builtin-report.c >>>>> @@ -1721,22 +1721,24 @@ int cmd_report(int argc, const char **argv) >>>>> symbol_conf.annotate_data_sample = true; >>>>> } >>>>> >>>>> - if (sort_order && strstr(sort_order, "ipc")) { >>>>> - parse_options_usage(report_usage, options, "s", 1); >>>>> - goto error; >>>>> - } >>>>> - >>>>> - if (sort_order && strstr(sort_order, "symbol")) { >>>>> - if (sort__mode == SORT_MODE__BRANCH) { >>>>> - snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s", >>>>> - sort_order, "ipc_lbr"); >>>>> - report.symbol_ipc = true; >>>>> - } else { >>>>> - snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s", >>>>> - sort_order, "ipc_null"); >>>>> + if (last_key != K_SWITCH_INPUT_DATA) { >>>>> + if (sort_order && strstr(sort_order, "ipc")) { >>>>> + parse_options_usage(report_usage, options, "s", 1); >>>>> + goto error; >>>>> } >>>>> >>>>> - sort_order = sort_tmp; >>>>> + if (sort_order && strstr(sort_order, "symbol")) { >>>>> + if (sort__mode == SORT_MODE__BRANCH) { >>>>> + snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s", >>>>> + sort_order, "ipc_lbr"); >>>>> + report.symbol_ipc = true; >>>>> + } else { >>>>> + snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s", >>>>> + sort_order, "ipc_null"); >>>>> + } >>>>> + >>>>> + sort_order = sort_tmp; >>>>> + } >>>>> } >>>>> >>>>> if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) && >>>>> >>>>> base-commit: 09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780 >>>> >>