From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D952C433E7 for ; Fri, 9 Oct 2020 06:24:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B72E722245 for ; Fri, 9 Oct 2020 06:24:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JTj/NsO7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wFH6lRtA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731028AbgJIGYg (ORCPT ); Fri, 9 Oct 2020 02:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgJIGYg (ORCPT ); Fri, 9 Oct 2020 02:24:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD00CC0613D2; Thu, 8 Oct 2020 23:24:35 -0700 (PDT) Date: Fri, 09 Oct 2020 06:24:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602224673; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nkbLu7hQZ47JlPjVe6Bgcpd1J54qsyfyMf79/3PLsI=; b=JTj/NsO7xxQO1aqOjkanzrVgb90b2Je3tuYw4qlaKZ4BGGOlNZqLJRhGOMX/Awzywk0C9k R/mOY3KhvlyLbSqMAo0bt3oTKAIj+A8tmIQfgGtHFyeE7rZ7VSFD9b99uqq8zlRdKZ1iy6 dGBiT07ydu979tm6othBvn/1LL9WtqFuNDrCARxPF+DrYLY7eItoiUwznd/HHEt8dz4gEY y/QpBLCGNvhw+a8jfzUwPs/r1SjQsrgnk9q3N4qY7TvbNU9+2GDuqZkD4syUo/nwyqAiS5 3leE8oTcD1oHrDWcGaCScYIvCHMWBElWfGTewCYrk4QIHe7WudeRKMMgRKCnaQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602224673; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1nkbLu7hQZ47JlPjVe6Bgcpd1J54qsyfyMf79/3PLsI=; b=wFH6lRtAO9ntx89saG0yT5qnZjRJL4MBLsLbLnQKU+DwQKl74p4dVB+vCShFLjuhMX9DzL 8OjryeU/0FP0OyBw== From: "tip-bot2 for Kajol Jain" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf: Fix task_function_call() error handling Cc: Srikar Dronamraju , Kajol Jain , "Peter Zijlstra (Intel)" , Ingo Molnar , Barret Rhoden , x86 , LKML In-Reply-To: <20200827064732.20860-1-kjain@linux.ibm.com> References: <20200827064732.20860-1-kjain@linux.ibm.com> MIME-Version: 1.0 Message-ID: <160222467221.7002.13972544073695390160.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 6d6b8b9f4fceab7266ca03d194f60ec72bd4b654 Gitweb: https://git.kernel.org/tip/6d6b8b9f4fceab7266ca03d194f60ec72bd4b654 Author: Kajol Jain AuthorDate: Thu, 27 Aug 2020 12:17:32 +05:30 Committer: Ingo Molnar CommitterDate: Fri, 09 Oct 2020 08:18:33 +02:00 perf: Fix task_function_call() error handling The error handling introduced by commit: 2ed6edd33a21 ("perf: Add cond_resched() to task_function_call()") looses any return value from smp_call_function_single() that is not {0, -EINVAL}. This is a problem because it will return -EXNIO when the target CPU is offline. Worse, in that case it'll turn into an infinite loop. Fixes: 2ed6edd33a21 ("perf: Add cond_resched() to task_function_call()") Reported-by: Srikar Dronamraju Signed-off-by: Kajol Jain Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Reviewed-by: Barret Rhoden Tested-by: Srikar Dronamraju Link: https://lkml.kernel.org/r/20200827064732.20860-1-kjain@linux.ibm.com --- kernel/events/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 7ed5248..e8bf922 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -99,7 +99,7 @@ static void remote_function(void *data) * retry due to any failures in smp_call_function_single(), such as if the * task_cpu() goes offline concurrently. * - * returns @func return value or -ESRCH when the process isn't running + * returns @func return value or -ESRCH or -ENXIO when the process isn't running */ static int task_function_call(struct task_struct *p, remote_function_f func, void *info) @@ -115,7 +115,8 @@ task_function_call(struct task_struct *p, remote_function_f func, void *info) for (;;) { ret = smp_call_function_single(task_cpu(p), remote_function, &data, 1); - ret = !ret ? data.ret : -EAGAIN; + if (!ret) + ret = data.ret; if (ret != -EAGAIN) break;