Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1293306pxb; Fri, 27 Aug 2021 05:58:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx37F+v9stgAVjp5E1j9rue5t3108qfc3CXKIExiLsLhVKbeD+c7HX+7ZKYBMvSnvl4CvUO X-Received: by 2002:a17:906:a195:: with SMTP id s21mr9841400ejy.181.1630069120783; Fri, 27 Aug 2021 05:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630069120; cv=none; d=google.com; s=arc-20160816; b=gfaeksx7FfQ2Uucg/VJujl9l89XnSWkoPD9bzcze5igfppMYMqqWqfKQF9qDF/YPFc UDPCvGy5mMMT4Yfcg8tv5iubKpkj88nyqClIxq08irzSGtPXHEf82LQDnK/t7+6YLbqr yAAIQ6hr3k6PuVKppJROkYKF3l/5tzqI4D2uSg9n9pjpnGDYxoIP5xqFle06lq/Unb+u 5SyjdXvVRV5KE8aKRt0sHx9Ry5OF6hr8JBRB2f4xIt9aV2TjjMzaFBnaC7aCkjTA91Ik fk8zPMI6MzlNziae42awBQDw2LS6Gy8iFxlrxbOSzV6nkINzwom6j28cum/3iIxiKypw 5ROQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PmIoYEQGodRJmMWo7Y06lgBn7jiODJwF67Pn0cQCnrg=; b=r4fHhyJu74rrPKTXkNdv8+fV4migASS8FhN/fyqUCV5SPyQFVhQABipgGQsRnUTA4v SPq8Rdp5lZY6vpgkL2XXM5mgNMmmHILRlC54wFSLrCiOC2TynwCDjxJFsk8RYRF83gTo tP8sZAc8EFUvSntv1yEu/PrUZbD4Piu6CkCAcEgdbJC8VxuCOstApJOeTb5+bBamolj/ cFq0PZwNd2lHlU1Balqa+KGBCdMj+QdZ3NunY+qebnF2C0SYZlkcAmEytjJ6GhpUcA6F PazVwLwFJmvu+s6Yy7IgVBgeaz/i692hDaWeMBvYUQ7zMX/eZ/B0mtMbR7T7w1ogZoXw C12Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=dcHFc6Mm; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv10si6036041ejb.316.2021.08.27.05.58.16; Fri, 27 Aug 2021 05:58:40 -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=@suse.com header.s=susede1 header.b=dcHFc6Mm; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245131AbhH0Mza (ORCPT + 99 others); Fri, 27 Aug 2021 08:55:30 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:34670 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbhH0Mz3 (ORCPT ); Fri, 27 Aug 2021 08:55:29 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 9BBB42022C; Fri, 27 Aug 2021 12:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630068879; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PmIoYEQGodRJmMWo7Y06lgBn7jiODJwF67Pn0cQCnrg=; b=dcHFc6MmXLODLgyqfIENf0jVMpsJgcM2cBEx9UBmJueTL+hicd+b7WWMj/zMXuGgyy6Hyy L67YJXPMUmMZj0LUMc2hWBF7xAOPS8xvA/BDDHYqJ/CtGFgQqosMqIwmm+rt06tCTzG7Iw LJVfrmtjLKSpLvU6SaCvXwF98IaJ+NU= Received: from suse.cz (unknown [10.100.224.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 809B7A3B95; Fri, 27 Aug 2021 12:54:39 +0000 (UTC) Date: Fri, 27 Aug 2021 14:54:39 +0200 From: Petr Mladek To: Vasily Gorbik Cc: Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Joe Lawrence , Heiko Carstens , Sven Schnelle , Sumanth Korikkar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] livepatch: Kick idle cpu's tasks to perform transition Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2021-07-07 14:49:38, 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. > > 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. I see. > > 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); Is this really needed? > + kick_process(task); This would probably do the job. Well, I wonder if the following is a bit cleaner. wake_up_if_idle(cpu); Also, please do this in klp_send_signals(). We kick there all other tasks that block the transition for too long. Best Regards, Petr