Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6776050rwl; Wed, 22 Mar 2023 15:49:58 -0700 (PDT) X-Google-Smtp-Source: AK7set/8G+gXEm7Tm6+uCP8L2s0wEOAUR+Je5pSdeTJhbzyFrcMPLwvaO9klCmH57XXrwsw896XR X-Received: by 2002:a17:90b:4ad0:b0:23d:77b3:907d with SMTP id mh16-20020a17090b4ad000b0023d77b3907dmr5542921pjb.22.1679525398681; Wed, 22 Mar 2023 15:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679525398; cv=none; d=google.com; s=arc-20160816; b=lSoWxAS+RdGWc3yNAVdxHd/PvaFtFbtvxigxdM/Q24e00aDynmVsRNAXlFW9CQ9pRi AIxvzXG0xMAAQE1RTEEpTHNhwUioZmGFzbMRMm8XspmyRMdysu32+devOWpaquf5BmfI Ze9F3nswznxQ+Ih82Ojci7usZVCLsBIDLRyUzkoMqXSt+ROppk5kO05QVb76Zg7Y3EDD Fyx968w7jb6wpe9l3++Y/MKHmc0AlacuHLtyhtNMskDuljeg7JNVfenQgyWVqAa7l+TE jssi8f8Ksm2zmTxjdT7SXeBjz/KqzuNhv+xtbSuUKozW3jDlP4E9qMiRMYFKGRxl0DPY nwDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=SDhT9TCsh0+kGa2j9Qd4A7H8TlQT3/KNsLPRBXRfuuI=; b=U1iWlxdqSPU+NefCCvPa6kl8jTOVXtrAYnAtMnWI7AGDcG3Dh5q4tjHLnAcKdf+snh U/Udq8HKvRsjM/Gi6wRM8nH18aPz2op1vd4JLpWqmeCm571G62wfIafHvIhrhEdd3ToI at9MQtAP+XzYoYMEkeIBG/3gCIikTTyXv6ORKa9UqO/TNpozrYZ2v/mK5hONV9vxC0RP mz6rB9i7pCbP5cRTVdxruLyh0K64tb6PYyyNuKKF6LCjxECdD2SNNIhVdAtATmz4g5iO LGRieIjYXuCZJyQNa+W3t/AfbIcJbBjFHr5o0uSAzYv9CnTUjL5gO8gzLLPbwKhll2Y/ cYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YG7Wzowa; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jCTTiZkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a63e202000000b0050bea5bf413si16342559pgh.705.2023.03.22.15.49.46; Wed, 22 Mar 2023 15:49:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=YG7Wzowa; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=jCTTiZkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229913AbjCVWs4 (ORCPT + 99 others); Wed, 22 Mar 2023 18:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjCVWsx (ORCPT ); Wed, 22 Mar 2023 18:48:53 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9FB40FC; Wed, 22 Mar 2023 15:48:53 -0700 (PDT) Date: Wed, 22 Mar 2023 22:48:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1679525331; 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=SDhT9TCsh0+kGa2j9Qd4A7H8TlQT3/KNsLPRBXRfuuI=; b=YG7Wzowa3aD/5R4c7J2Eo/Mt+bNUqpoaMiQHZG6NbLj5dQSzySr/X+uP8or/R8PcrCFT4d R7Xi3GXVkx9GIvg2d8GdmovMbf2CSyxOhl0c12YYYIMx66duozIJqpVKPSh8XL5krlX6Y2 OmjTmT64lcjhc9jDtWENixhPh0iW0siy7MMVr4LNM70C8e1BMzSIkzz81cDmhyDFQluBx6 a9xd3eC5wkoDmstisF0biTGFVVXtLx1x9tn5bVOL7/1+p2rOeufat+gRpcrIj4KP+GrmRU EO+gM9hmxnFZ74xGVb6tTzqXsMGgghHA5xMX7dAR59mK2HM8adWBmSONb5g3cQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1679525331; 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=SDhT9TCsh0+kGa2j9Qd4A7H8TlQT3/KNsLPRBXRfuuI=; b=jCTTiZkOgCochuKJ1LCQsIrhv/sEJIZla733ujD8RCOG3u0NJFZP2HN2idOMej03l2iMbd 2E8ySdl6te3JJlAw== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] livepatch: Skip task_call_func() for current task Cc: Josh Poimboeuf , "Peter Zijlstra (Intel)" , Petr Mladek , "Seth Forshee (DigitalOcean)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <4b92e793462d532a05f03767151fa29db3e68e13.1677257135.git.jpoimboe@kernel.org> References: <4b92e793462d532a05f03767151fa29db3e68e13.1677257135.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <167952533112.5837.7165959544411828393.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 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 383439d3d400d4c5a7ffb4495124adc6be6a05e2 Gitweb: https://git.kernel.org/tip/383439d3d400d4c5a7ffb4495124adc6be6a05e2 Author: Josh Poimboeuf AuthorDate: Fri, 24 Feb 2023 08:49:59 -08:00 Committer: Peter Zijlstra CommitterDate: Wed, 22 Mar 2023 17:09:28 +01:00 livepatch: Skip task_call_func() for current task The current task doesn't need the scheduler's protection to unwind its own stack. Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Petr Mladek Tested-by: Seth Forshee (DigitalOcean) Link: https://lore.kernel.org/r/4b92e793462d532a05f03767151fa29db3e68e13.1677257135.git.jpoimboe@kernel.org --- kernel/livepatch/transition.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c index 135fc73..824e2e3 100644 --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -312,7 +312,11 @@ static bool klp_try_switch_task(struct task_struct *task) * functions. If all goes well, switch the task to the target patch * state. */ - ret = task_call_func(task, klp_check_and_switch_task, &old_name); + if (task == current) + ret = klp_check_and_switch_task(current, &old_name); + else + ret = task_call_func(task, klp_check_and_switch_task, &old_name); + switch (ret) { case 0: /* success */ break;