Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 772BAC61DA4 for ; Thu, 9 Feb 2023 19:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjBITS2 (ORCPT ); Thu, 9 Feb 2023 14:18:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbjBITS0 (ORCPT ); Thu, 9 Feb 2023 14:18:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F898458A1; Thu, 9 Feb 2023 11:18:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8574B8202F; Thu, 9 Feb 2023 19:18:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07908C433EF; Thu, 9 Feb 2023 19:18:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675970303; bh=2N2cNIU1XW5YmMOreRcBKEoSVcSbJ0JNBK/ngcNtt9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJ+0bCl0DYiLH3J2h2I74scxWV26SXxTDm1arHtllsr8w1Bq1EuE6aoePIvqs6ryi CfWcMTuzcZQCO3ceinvRXyadBcBNfkzYhtrdAnqVWVpAenvUbPrt7o97lP71TOgneU A8qBJefAmcCCMWG8D9fOfo2n8Fqis275rcLismrol8xdsrD11GJ0qmzqc74v06XFeV 1ngvEc6mfBrKZeKCAl2ZvA2LV+l8vfFAkFMA93hyPUFH9JkybLkldcyVeSP0MmqHM+ JBWKklr8/bso6Ry+CjEaHttL2xa7Geu5OzAgO6W8W/PCzHGE8tINlDYZyeqII2Og47 atGwj4GGGuLSQ== From: Josh Poimboeuf To: live-patching@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Seth Forshee , Peter Zijlstra , Song Liu , Mark Rutland , Petr Mladek , Joe Lawrence , Miroslav Benes , Jiri Kosina , Ingo Molnar Subject: [PATCH 1/3] livepatch: Skip task_call_func() for current task Date: Thu, 9 Feb 2023 11:17:47 -0800 Message-Id: X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current task doesn't need the scheduler's protection to unwind its own stack. Signed-off-by: Josh Poimboeuf --- 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 f1b25ec581e0..4d1f443778f7 100644 --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -307,7 +307,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; -- 2.39.0