Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756035AbbBLPtX (ORCPT ); Thu, 12 Feb 2015 10:49:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53179 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755299AbbBLPtW (ORCPT ); Thu, 12 Feb 2015 10:49:22 -0500 Date: Thu, 12 Feb 2015 09:48:52 -0600 From: Josh Poimboeuf To: Jiri Slaby Cc: Ingo Molnar , Peter Zijlstra , Masami Hiramatsu , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Seth Jennings , Jiri Kosina , Vojtech Pavlik Subject: Re: [RFC PATCH 6/9] livepatch: create per-task consistency model Message-ID: <20150212154852.GF18578@treble.redhat.com> References: <2c3d1e685dae5cccc2dfdb1b24c241b2f1c89348.1423499826.git.jpoimboe@redhat.com> <20150212032121.GA18578@treble.redhat.com> <54DCAA12.9070400@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <54DCAA12.9070400@suse.cz> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1586 Lines: 37 On Thu, Feb 12, 2015 at 02:26:42PM +0100, Jiri Slaby wrote: > On 02/12/2015, 04:21 AM, Josh Poimboeuf wrote: > > Ingo, Peter, > > > > Would you have any objections to making task_rq_lock/unlock() non-static > > (or moving them to kernel/sched/sched.h) so they can be called by the > > livepatch code? > > > > To provide some background, I'm looking for a way to temporarily prevent > > a sleeping task from running while its stack is examined, to decide > > whether it can be safely switched to the new patching "universe". For > > more details see klp_transition_task() in the patch below. > > > > Using task_rq_lock() is the most straightforward way I could find to > > achieve that. > > Hi, I cannot speak whether it is the proper way or not. > > But if so, would it make sense to do the opposite: expose an API to walk > through the processes' stack and make the decision? Concretely, move > parts of klp_stacktrace_address_verify_func to sched.c or somewhere in > kernel/sched/ and leave task_rq_lock untouched. Yeah, it makes sense in theory. But I'm not sure how to do that in a way that prevents races when switching the task's universe. I think we need the rq locked for both the stack walk and the universe switch. In general, I agree it would be good to find a way to keep the rq locking functions in sched.c. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/