Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3795764imm; Mon, 11 Jun 2018 01:46:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKIk9XD8HjXzsl/9kvMylLKQ2IRPT7kHRfkUP5Mgi+hAuelVBmsIFEpw6GcY5gKcE8ycIA4 X-Received: by 2002:a65:6690:: with SMTP id b16-v6mr13929276pgw.326.1528706782997; Mon, 11 Jun 2018 01:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528706782; cv=none; d=google.com; s=arc-20160816; b=GI84+i/n2hVZHUkh9Gr/Z06kDrH41kCBLiWXEoExwSdmGPCGZ0Y/VzRTO6rJ8csO0y ZBDeUeigdAcw5cv2FlNXaa1yxDPi196wz9YBvpTzdvxf3RY3y2QW2aLMiqk7FvC5uwSL kyPxRFnxk6mjQmcZBlBj+0ZhUxyzQLO2XYBpr6GvI9bzeb5CtEJClc4XXIru300Gg1+9 DoL+AbMGreRS538Gxsq7ACA7lenG+WnzC+7QXBUhpWcVCmvRPmvX9WXKRDhKqf5U4KAr QjveKcEzuZAP0B81JXc8006eajIHoleMTDY+dr5+ytvVUj2SYZFHCP15Xppd0ViTPjeR OQlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=QHzs3swv/XbZEVPxdNoT7lYpBKeQeKqJpYnxPXCWV5s=; b=UdPl4XemrAwgdYnjpMRG3T7TJ02i0TcM5hIGGtqFZPqxHZ0F9OIp0lNNtu6QZTbA3q /ifmXV+dcmffL4Y90jLs7ugvRUd+mJRFn0qkBRnF78Hgar1l69i6oMuVD9abLeMWjrPi Xnpi+9kpGgjtqys2ZB4xQ0aqothk16VllWs8RmzO1n1gUDYQE8uPJHj5h3D0+n21g9QH M51cheX7hfXzCUioaQyF02Wj2Livph1rPEKbevMVi6JC58nazTC9UopLC7h7+32yjyPQ IXVZoRa0kGghEMAtHse6pftLVInE6dkcBQBWcWg/hQdcgNwQ8WF19RoWwNBanSQh1oaG 7JEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u17-v6si13876756pgv.455.2018.06.11.01.46.08; Mon, 11 Jun 2018 01:46:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932536AbeFKIp0 (ORCPT + 99 others); Mon, 11 Jun 2018 04:45:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:45828 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247AbeFKIpX (ORCPT ); Mon, 11 Jun 2018 04:45:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E088DACCA; Mon, 11 Jun 2018 08:45:21 +0000 (UTC) Date: Mon, 11 Jun 2018 10:45:21 +0200 From: Petr Mladek To: Miroslav Benes Cc: Josh Poimboeuf , jikos@kernel.org, jeyu@kernel.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: Send a fake signal periodically Message-ID: <20180611084521.3lq7bjwnj3zpenjw@pathway.suse.cz> References: <20180604141636.11523-1-mbenes@suse.cz> <20180604141636.11523-2-mbenes@suse.cz> <20180604180325.yeewbafxpjkt6gi5@treble> <20180605140040.in2ndsb34o42hert@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2018-06-06 09:49:50, Miroslav Benes wrote: > On Tue, 5 Jun 2018, Josh Poimboeuf wrote: > > > On Tue, Jun 05, 2018 at 09:17:52AM +0200, Miroslav Benes wrote: > > > On Mon, 4 Jun 2018, Josh Poimboeuf wrote: > > > > > > > On Mon, Jun 04, 2018 at 04:16:35PM +0200, Miroslav Benes wrote: > > > > > An administrator may send a fake signal to all remaining blocking tasks > > > > > of a running transition by writing to > > > > > /sys/kernel/livepatch//signal attribute. Let's do it > > > > > automatically after 10 seconds. The timeout is chosen deliberately. It > > > > > gives the tasks enough time to transition themselves. > > > > > > > > > > Theoretically, sending it once should be more than enough. Better be safe > > > > > than sorry, so send it periodically. > > > > > > > > This is the part I don't understand. Why do it periodically? > > > > > > I met (rare!) cases when doing it once was not enough due to a race and > > > the signal was missed. However involved testcases were really artificial. > > > > > > > Instead, might it make sense to just send the signals once, and if that > > > > doesn't work, reverse the transition? Then we could make patching a > > > > synchronous operation. But then, it might be remotely possible that the > > > > reverse operation also stalls (e.g., on a kthread). So, maybe it's best > > > > to just leave all these controls in the hands of the user. > > > > > > And there is 'force' option... > > > > > > So given all this, I'd call klp_send_signals() once and then leave it up > > > to the user. Would that work for you? > > > > Well, I don't know. Since the patching process will already need to be > > managed by user space, what's the benefit of having the kernel doing > > only this part of it? > > I'm not sure about 'will already need to be managed by user space' part. > Sending the fake signal would unblock transition in certain cases "for > free". No user interaction is really needed and we can do it > automatically. That's why I find it beneficial. I wonder if several kicks might be necessary to get a kthread patched. BTW: This approach has a bit different effect in compare with kGraft. In kGraft, it was enough to force kthread going over an explicitly defined safe point where it migrated itself. In upstream, the kthread must get scheduled outside any patched function. The chance might be a bit random. To make it clear. I believe that sending signal once makes sense for sure. And it would make sense to even repeat it. BTW: If we allow to repeat it, we should reset the counter in klp_reverse_transition(). Best Regards, Petr