From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932957AbdERMBF (ORCPT ); Thu, 18 May 2017 08:01:05 -0400 Received: from mx2.suse.de ([195.135.220.15]:56511 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933556AbdERMBB (ORCPT ); Thu, 18 May 2017 08:01:01 -0400 From: Miroslav Benes To: jpoimboe@redhat.com, jeyu@redhat.com, jikos@kernel.org Cc: pmladek@suse.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes , Oleg Nesterov Subject: [PATCH 0/3] livepatch: Introduce force sysfs attribute Date: Thu, 18 May 2017 14:00:40 +0200 Message-Id: <20170518120043.7205-1-mbenes@suse.cz> X-Mailer: git-send-email 2.12.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, livepatch gradually migrate the system from an unpatched to a patched state (or vice versa). Each task drops its TIF_PATCH_PENDING itself when crossing the kernel/user space boundary or it is cleared using the stack checking approach. If there is a task which sleeps on a patched function, the whole transition can get stuck indefinitely. Livepatch has means which can be used in these cases. The transition can be cancelled and/or immediate flag may be used for the live patch. On the other hand it might be useful to poke the system a little bit and help the transition to finish by doing so. That is what the fake signal can be used for. A task sleeping/waiting in the kernel gets TIF_SIGPENDING set, it handles it and during that its TIF_PATCH_PENDING is cleared. Kthreads are only woken up, they do not handle signals suitably. Still, there are cases which neither fake signal can solve. A task can sleep uninterruptibly without reacting to signals at all. Even then, it may be safe to clear the task's TIF_PATCH_PENDING. As a last resort, admin may force such clearing for all tasks in the system with this patch set. We use the fake signal in SLES for a long time. Moreover, we don't have a stack checking there, so we rely on the fake signal a lot. We send it automatically and periodically. The first patch is only preparatory. It introduces the sysfs attribute through which both actions are performed. The second patch adds the fake signal and the third one forced clearing of the flag. Miroslav Benes (3): livepatch: Add force sysfs attribute livepatch: send a fake signal to all blocking tasks livepatch: force transition process to finish Documentation/ABI/testing/sysfs-kernel-livepatch | 9 ++++ include/linux/livepatch.h | 4 ++ kernel/livepatch/core.c | 51 +++++++++++++++++++++ kernel/livepatch/transition.c | 56 ++++++++++++++++++++++++ kernel/livepatch/transition.h | 2 + kernel/signal.c | 4 +- 6 files changed, 125 insertions(+), 1 deletion(-) -- 2.12.2