From patchwork Wed Mar 22 22:48:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 73689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2612408wrt; Wed, 22 Mar 2023 15:54:17 -0700 (PDT) X-Google-Smtp-Source: AK7set/GhELoDumd5+W8m8ebi3xUWfTvJbF+3plyMAvPd5qpZxjd0+0EWgCHfiVNTBwucfAMWOBo X-Received: by 2002:aa7:842c:0:b0:624:3061:7dbf with SMTP id q12-20020aa7842c000000b0062430617dbfmr4898924pfn.25.1679525657600; Wed, 22 Mar 2023 15:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679525657; cv=none; d=google.com; s=arc-20160816; b=ufsTjdx6hW9076zPqAw1fjEm5M5a+ZVF9rFdi0Cxfz96hq9+Nhwa6ZJ8X3nenO78+v QQ+tbIPpXN/8QIp4CYhm4sjWAHyPeAXR0+LMjYXr1AC30qYEAqAJHOLZtyInwtkq4NPj UrDckId/V91/KDUOEf0xn5pMxkK/M7p1ddfFbeL4+Wes8XPetEUCQhD+EGyWOOCJSVBE XaOQzzSBN4hrYG+oBRoUvFbV5XnvZ7BcEq2iTBS+hIb8VWx/qD0T6QEnUhkeom0te1h8 UeOKeyktGaYIANLdJxzHYo7PcX5VJI3ML60QwuIvot1M0jMux8niSLwe3Y6wC3I8vG5a RGMg== 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; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a6540cb000000b00502ece2f57dsi16806914pgp.655.2023.03.22.15.54.04; Wed, 22 Mar 2023 15:54:17 -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; 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 S229917AbjCVWs5 (ORCPT + 99 others); Wed, 22 Mar 2023 18:48:57 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758732665726688184?= X-GMAIL-MSGID: =?utf-8?q?1761110295427567769?= 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;