Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp900491pxt; Fri, 6 Aug 2021 17:25:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG51uS8bLgytpqpqKSdnLF+KsB0yXgjOgolpLiyXl5go84Dm5Zl+vAzJI2vG/2TiSJZLYx X-Received: by 2002:a02:cc90:: with SMTP id s16mr12010004jap.131.1628295933008; Fri, 06 Aug 2021 17:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628295933; cv=none; d=google.com; s=arc-20160816; b=DcWpP/z1AeSoUMxHzvnsk1tFftXVuTdSR7zpppznW3/4ws0mXeq8ZzD7ZslqOZhkp6 0G55ljNHnJC+bwJpgzmTa4PnLOTU9kzM35TaiU81SFXPyZORm1Tx3Ajx+YnLhFAPmY/z u1wdyObjGoLNVA1WFJ/QSMK9gLm5JYVCcKTqV9yqG/5HF9HuwX2dFedfuxKfiG5RCKPH yO3LcBd1Q9lSVwEnXdhW8kkM+CV/KifVoS1XJf0MCQpetcYJ2FJ5o81J0vug3p8Jepyo KlgOcAjOK9V6+nDk3vjW6e8ylRRrprpN8g67D7Sv9tXLFB2fQj146X17Ljy6P5coNe0h ugUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=MFcpdksmO/jlYYdvb2rl+zm6YLAzt31WealFmRADfcI=; b=mI3TFJWQ0IIJcxOoAL0sG2RPhLtSzdMewtZm+AfkT6HGJhHIqWclQFZ4qbG7G5aEnB s3pjbuizloQntOIk/Mjc5O/4c/9AE+09Ltl2T+Cj8IGBghhiCgfj8TJV6N2SQ8J0/9Nm OjcAfLy9G/2dwLFDmuD8o0Tj+vSYH0pdMaX5A3xZX89IIFYlxV8jZ2Rewzz7v7dFVI2G aJK9oRB5McCJLovFRvHT/UWpFqsg7go3Fb8921IfS4vfGruIYedEYVZrSDBXleDdOIzR c/DFUL4cer4PcgPGzyhbSkjdT4uIaaUdtnL2vb/WW/s0XK33AbolVDH71EIG4Zrsrvlu /CPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LzHoz1WB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o1si2082964iou.79.2021.08.06.17.25.18; Fri, 06 Aug 2021 17:25:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LzHoz1WB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbhHFX7U (ORCPT + 99 others); Fri, 6 Aug 2021 19:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbhHFX7U (ORCPT ); Fri, 6 Aug 2021 19:59:20 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25DDC0613CF; Fri, 6 Aug 2021 16:59:02 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id k2so9168064plk.13; Fri, 06 Aug 2021 16:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=MFcpdksmO/jlYYdvb2rl+zm6YLAzt31WealFmRADfcI=; b=LzHoz1WBSw98VA6YamFlirg4iypXLZPOjYRyLi+fa8cQvf/7Lldw8HcolLai7aolsJ 1Qa67RmzrjwGpO0SmIWrS1Werdzb+2xmDGv//KgiFy3K9aNSSbgfzJvREEC98L92n7iY p17SLlKIEAo+wwKORMKRU0vT+Fn1gcxkeonqlVs2AeCziptSVnOVl/Nh+4LJxQrhL3Ok L0rmLklYkiYHCop5JCiyD5rer91zAx+GIFdwze1ZwehQbJlZ+kIH7wjtYZEf/b4TsOt8 0wbjwxZ2m+MmdfupmqSUSMf8BI5BPxMy1stBLtFUVmJjG+E/kDyyFOWsSQSnNMOYnZUr RMKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=MFcpdksmO/jlYYdvb2rl+zm6YLAzt31WealFmRADfcI=; b=bxtDqfaXTgu2lAvhLFJdvQ/xTV23j0axrBMc4Rn6ib0foiH31Zy3J50maKqF+Kwhg1 f/tzf1h5ZZWyKAfkwr2KfphYcMlwSNi0xUB1jCm1nOckwKqFYEozNMcaV9l1nVmTi2CU nTidQtLfqeRrKxumfFnGnKcvsRVkN1boqtHMZhMFUhC7MyLbr4cLC5g5whx/r54YIkwl 4I/uBykpPvM+ge/rHcub8VcR1b3gNImKVmpf4OrZ3vxmyOfSN3KTkxfcJ5gOmI9Hnl4k cjyrWJ2+UE56qRcAtzLnesayP4zNl+uOiiCgy0U2DIpJ3d3RaHktwp7a0jllUHL+XNcH K3AA== X-Gm-Message-State: AOAM531LehLzpBFmNymWQQRJmpyfOe/j3g75s1iX3jtaOhpC7dlqiTDM Bb1rLcJSbnfGnT1TyTTk27E= X-Received: by 2002:a17:902:e04e:b029:12c:def4:56a3 with SMTP id x14-20020a170902e04eb029012cdef456a3mr9874185plx.76.1628294342188; Fri, 06 Aug 2021 16:59:02 -0700 (PDT) Received: from xray-cmxmeta-1a-i-575ab9cd.us-east-1.amazon.com ([205.251.233.176]) by smtp.googlemail.com with ESMTPSA id e8sm2420058pjg.4.2021.08.06.16.59.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Aug 2021 16:59:01 -0700 (PDT) Message-ID: <5b4f3fdddd418a39d4054981df03333b46d8ae2c.camel@gmail.com> Subject: Re: [RFC PATCH] livepatch: Kick idle cpu's tasks to perform transition From: Suraj Jitindar Singh To: Vasily Gorbik , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek Cc: Joe Lawrence , Heiko Carstens , Sven Schnelle , Sumanth Korikkar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 06 Aug 2021 16:59:00 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-07-07 at 14:49 +0200, Vasily Gorbik wrote: > On an idle system with large amount of cpus it might happen that > klp_update_patch_state() is not reached in do_idle() for a long > periods > of time. With debug messages enabled log is filled with: > [ 499.442643] livepatch: klp_try_switch_task: swapper/63:0 is > running > > without any signs of progress. Ending up with "failed to complete > transition". > > On s390 LPAR with 128 cpus not a single transition is able to > complete > and livepatch kselftests fail. This also speeds up completion of the transition on high cpu count arm instances. Interested in seeing the correct way to address this. Suraj. > > To deal with that, make sure we break out of do_idle() inner loop to > reach klp_update_patch_state() by marking idle tasks as NEED_RESCHED > as well as kick cpus out of idle state. > > Signed-off-by: Vasily Gorbik > --- > kernel/livepatch/transition.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/livepatch/transition.c > b/kernel/livepatch/transition.c > index 3a4beb9395c4..793eba46e970 100644 > --- a/kernel/livepatch/transition.c > +++ b/kernel/livepatch/transition.c > @@ -415,8 +415,11 @@ void klp_try_complete_transition(void) > for_each_possible_cpu(cpu) { > task = idle_task(cpu); > if (cpu_online(cpu)) { > - if (!klp_try_switch_task(task)) > + if (!klp_try_switch_task(task)) { > complete = false; > + set_tsk_need_resched(task); > + kick_process(task); > + } > } else if (task->patch_state != klp_target_state) { > /* offline idle tasks can be switched > immediately */ > clear_tsk_thread_flag(task, TIF_PATCH_PENDING);