From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964874AbdAFPLE (ORCPT ); Fri, 6 Jan 2017 10:11:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:54023 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964812AbdAFPKw (ORCPT ); Fri, 6 Jan 2017 10:10:52 -0500 Date: Fri, 6 Jan 2017 16:10:50 +0100 (CET) From: Miroslav Benes To: Petr Mladek cc: jpoimboe@redhat.com, jeyu@redhat.com, jikos@kernel.org, corbet@lwn.net, live-patching@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Documentation/livepatch: remove the limitation for schedule() patching In-Reply-To: <20170106150140.GX14894@pathway.suse.cz> Message-ID: References: <20170106140045.26331-1-mbenes@suse.cz> <20170106150140.GX14894@pathway.suse.cz> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Jan 2017, Petr Mladek wrote: > On Fri 2017-01-06 15:00:45, Miroslav Benes wrote: > > The Limitations section of the documentation describes the impossibility > > to livepatch anything that is inlined to __schedule() function. This had > > been true till 4.9 kernel came. Thanks to commit 0100301bfdf5 > > ("sched/x86: Rewrite the switch_to() code") from Brian Gerst there is > > __switch_to_asm function now (implemented in assembly) called properly > > from context_switch(). RIP is thus saved on the stack and a task would > > return to proper version of __schedule() et al. functions. > > > > Of course __switch_to_asm() is not patchable for the reason described in > > the section. But there is no __fentry__ call and I cannot imagine a > > reason to do it anyway. > > > > Therefore, remove the paragraphs from the section. > > > > Signed-off-by: Miroslav Benes > > It is great to get a feature for free ;-) > > Reviewed-by: Petr Mladek > > Best Regards, > Petr > > --- > > FWIW, I also tested this to be sure on top of the consistency model > > patch set. I patched schedule() function which calls __schedule() (it is > > impossible to patch it directly due to notrace attribute). It works well > > except... > > > > 1. the patching process does not finish, because many tasks sleep in > > schedule. STOP/CONT signal does not help. I'll investigate. > > Are these userspace processes or kthreads? Kthreads would cause > problems because they do not handle signals. Userspace processes, but I take it back. Stupid typo in my script. It works as expected. Kthreads sleeping in schedule() are of course there and a signal does not help. Miroslav