Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp565406imm; Tue, 5 Jun 2018 00:18:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKc9d275dPHrlN/jRSBDONITny7fh3ol5f48upd5K7creEMu9y51glNllgqgBoy6y3Xzlyo X-Received: by 2002:a63:24c4:: with SMTP id k187-v6mr17100705pgk.434.1528183112815; Tue, 05 Jun 2018 00:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528183112; cv=none; d=google.com; s=arc-20160816; b=UZTjZY+DT2SklMM5af2k0aL/MISSqDOKvIjg6szA7jYTw5JLIIJebtU1cGJeh+ceVg ktCr6r5naL4ybzjiSuVfK+gjpyYXGYGBhJ9PT85QiRsu5hqQVbXnOWKux+gr7dYMghgR IczEzpT2bpaoVJy4U4rwlphklbgsS2TKVLpelP2zNwzlVlt9a6SnY74WQnXIzn7cZGqk l3DET2SeTz+CN+NNMQ3O7r5xs8u0LqviT5H3IprOQryn4R2JP58JSDo1kmb2135a/FcW KwH9adVvKDlXsypM64x2riqorMtwiy+XKEz4V3y/gXpcI3DGb0hhl/t4+BaXORHtKla7 BZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=IaUo7//Dp18/VkZa7YZ/IMtGkTynw5nf9aRgdX97pMQ=; b=YLDXQVaBXcGjowi9YIoQpY2L7JR5kdX7ZEz44FFF+ZDU4iTwQEWbdxbtfJ91ZzgO/C 8CbhMpunD5t64ijf9lXKWNqea0fNPlXdgzurP9nnyiFNswERo1wIDQVe4Am7EyZsSzIH nXWRa9WgW48aDWc2ididwr30oBPpVBEL+232TVhhN65My6D7j+VmGpbv91vENsTuHOZt lE4Cte8FtgB5dTW+Gf7+Rzcs34gBkVEj2ZnhA4qrJhhwbNYmF3YoprRj1HPO1sb/RPxA uCevzlK62TLIwVujIV1XDBmIFzXVoOrQCMFUoS+qZoPLtcfXkUdHat0KH4JkmZIm9oJt sh7Q== 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 y8-v6si19165682pgs.181.2018.06.05.00.18.18; Tue, 05 Jun 2018 00:18:32 -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 S1751512AbeFEHRz (ORCPT + 99 others); Tue, 5 Jun 2018 03:17:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:42030 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbeFEHRy (ORCPT ); Tue, 5 Jun 2018 03:17:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AB347AEB0; Tue, 5 Jun 2018 07:17:52 +0000 (UTC) Date: Tue, 5 Jun 2018 09:17:52 +0200 (CEST) From: Miroslav Benes To: Josh Poimboeuf cc: jikos@kernel.org, jeyu@kernel.org, pmladek@suse.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] livepatch: Send a fake signal periodically In-Reply-To: <20180604180325.yeewbafxpjkt6gi5@treble> Message-ID: References: <20180604141636.11523-1-mbenes@suse.cz> <20180604141636.11523-2-mbenes@suse.cz> <20180604180325.yeewbafxpjkt6gi5@treble> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > All that said, a few code review comments: > > - AFAICT, it does an 8 second delay instead of a 10 second delay, > because Not that it matters, because it is still wrong, but it is a 9 second delay (or I miscounted again). > a) try_complete_transition() is first called before there's any delay; > > b) the preincrement operator used on signals_cnt. > > - I think 15 seconds might be a better default. I've seen longer > patching delays on a system with 100+ CPUs. Ok, why not. > - If a kthread or idle task is sleeping on a patched function, the > pr_notice("signaling remaining tasks\n") will be repeated continously. True. > - It might be cleaner to do it from the delayed work function > (klp_transition_work_fn). I considered it but then decided to do it in klp_try_complete_transition() under 'if (!complete)'. It belongs right there in my opinion. Thanks, Miroslav