Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp225193pxf; Thu, 25 Mar 2021 02:34:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL+hsHsnUCtZ69FHUD6kE/s4HP9H+JH8cKQkQ3Ra1jTDZx36sNVvG+Sy+KMXIF8oOl3OVr X-Received: by 2002:aa7:ce1a:: with SMTP id d26mr7974195edv.206.1616664879596; Thu, 25 Mar 2021 02:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616664879; cv=none; d=google.com; s=arc-20160816; b=o4YZLGgDPh61N9AQduHdnRRbxKu3oBPxOLo461PzO0CBkuwPUWDz96ebamy+6sYL7J 1ISwebiEWOZDWPztf713Y05vX35VcEyr+TRn2rSFKIKwUPKRrp/fMsWcpezHHiHdi66e uICoFmPNt41rt0LEcNyz+b2jPCQOJYcPFQgFE9YSZbqMFffCopB1RrCMCSEHZCHyRJ5b 1NlXMKr4wX2EV4hpN4zo0sMxSIH8cf69EhftB1HGd/4IpvAVJ4s2qvyB1mBqu2sBhcW/ sP48lhzBi0P63hX019ECx855cd9/Pj7rslU3nCNWVb1zTceLUFSxs2AZIoAKghlbuVXo 2low== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=NOK/qjRwcooctECon+Fll4jWdNOFHjsEVVl+4zl3K3s=; b=ak238FW/gQwzH0Ujp2qPUorcxThzLTNZOz6806EwLmsFeIlOpWHL78IQPXwlkGMe3f 6aHsOeqb8LUb/3tLW8rBrAkUCh5MrxlW2FpfWUL9WsohCzKKk/RDnLzwiZVYYttGlM9u Xj7nS4i30AkoPqR7Zq1pf+RBnT8fbj1zDM8vQeUtQX4v9AurEVvq470iSNesxiWymmkD 5rs+yE46k9TjvE/AqkH4DzWm7bB/o/d406zTLadKY3PxDb7dCPvW9/jS4eCHft3gDvxy LnXpEUEH60NjsP0mZIuOCVlfAyr2ngl8G+tcSxxwwSSVaPVVfKeeGLZRp7Pc3GKiSK09 JKsg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si3744448edn.67.2021.03.25.02.34.16; Thu, 25 Mar 2021 02:34:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229744AbhCYJbJ (ORCPT + 99 others); Thu, 25 Mar 2021 05:31:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:57434 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbhCYJai (ORCPT ); Thu, 25 Mar 2021 05:30:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1A2C7AA55; Thu, 25 Mar 2021 09:30:37 +0000 (UTC) Date: Thu, 25 Mar 2021 10:30:36 +0100 (CET) From: Miroslav Benes To: Joe Lawrence cc: Dong Kai , jpoimboe@redhat.com, jikos@kernel.org, pmladek@suse.com, axboe@kernel.dk, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] livepatch: klp_send_signal should treat PF_IO_WORKER like PF_KTHREAD In-Reply-To: Message-ID: References: <20210325014836.40649-1-dongkai11@huawei.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > (PF_KTHREAD | PF_IO_WORKER) is open coded in soo many places maybe this is a > silly question, but... > > If the livepatch code could use fake_signal_wake_up(), we could consolidate > the pattern in klp_send_signals() with the one in freeze_task(). Then there > would only one place for wake up / fake signal logic. > > I don't fully understand the differences in the freeze_task() version, so I > only pose this as a question and not v2 request. The plan was to remove our live patching fake signal completely and use the new infrastructure Jens proposed in the past. Something like diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c index f6310f848f34..3a4beb9395c4 100644 --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -9,6 +9,7 @@ #include #include +#include #include "core.h" #include "patch.h" #include "transition.h" @@ -369,9 +370,7 @@ static void klp_send_signals(void) * Send fake signal to all non-kthread tasks which are * still not migrated. */ - spin_lock_irq(&task->sighand->siglock); - signal_wake_up(task, 0); - spin_unlock_irq(&task->sighand->siglock); + set_notify_signal(task); } } read_unlock(&tasklist_lock); diff --git a/kernel/signal.c b/kernel/signal.c index a15c584a0455..b7cf4eda8611 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -181,8 +181,7 @@ void recalc_sigpending_and_wake(struct task_struct *t) void recalc_sigpending(void) { - if (!recalc_sigpending_tsk(current) && !freezing(current) && - !klp_patch_pending(current)) + if (!recalc_sigpending_tsk(current) && !freezing(current)) clear_thread_flag(TIF_SIGPENDING); } Let me verify it still works and there are all the needed pieces merged for all the architectures we support (x86_64, ppc64le and s390x). I'll send a proper patch then. Miroslav