Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5279431yba; Tue, 30 Apr 2019 12:03:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzo14urlRpiaZ1AoGF2jbG/yCrVA42AJaRZ0It6FSo2UQcqXPSRGUN5vGoUPm8MbUnpgqVg X-Received: by 2002:a63:6983:: with SMTP id e125mr64234087pgc.370.1556650987497; Tue, 30 Apr 2019 12:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556650987; cv=none; d=google.com; s=arc-20160816; b=CfTIi4vZ0h7xl03tH3iEkb0UVsynZZi7RvanM5vw77YnrtjYeekqqH8yQpCUKSQl8B ApSEL7xpv4S8bf0mtiAeZcvUzWKGD28imo4zqPEUyVn3WIzYcbme0tQW6u/lwPQRw74v gUULWKqSDs/VaH5LOxSM5bJDaUpOQq/j7K/AQQ/+hP17L1QXbF0C0kWl3ng/SLyY4HHE TEWqa9M87iNqDibgHsQBiEmjtmrl6ZzCUHLt1xfqcDlGz3YSTI5eetUxlZbYhm5RDrEh VWSj8/Wk1Q+c4SBkPFYsnepSJqKHnQmp4842Od/x9OGLHhun0/Z3tS9kOZnSWgji2WcE U/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=4s5TNzVPlhJ2RrkqBlaoy3TP3PB9uHYnW368RSnVqFI=; b=auYF/v2IqKUYtlcQh4+kAyWIZOm6zlanIxZ11x7U6XjpPQfeWvuKQJ9O8a/wZia1CT /V/UWTr1ehEY809ldp29X02Mbhxv/i8wOExmYNulCzqTHsnJtncPp8nx8lUWwu/ci7WT pGiCGvRhujmq43J3EEtiWgAatGv5Q24O9O4JUHNSgtDK4AVPYYtTjPcH51KVM+Eaagve PRohccuI8EUUBinLXN1g+mg9j0VvaDcpBVa1wvvpKHdMAVNnWo82WbZ2mdKRp00xsXGY 3d/dgp9emapC9pDFzCbxPDv3slFnjiyo3EP+UyUqI+zTkhTQp3WX2hwizrgb93WLo7KK rc8A== 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 n19si10729509pgh.457.2019.04.30.12.02.51; Tue, 30 Apr 2019 12:03:07 -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 S1727205AbfD3TAR (ORCPT + 99 others); Tue, 30 Apr 2019 15:00:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:48614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfD3TAR (ORCPT ); Tue, 30 Apr 2019 15:00:17 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 27C7820854; Tue, 30 Apr 2019 19:00:14 +0000 (UTC) Date: Tue, 30 Apr 2019 15:00:12 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Andy Lutomirski , Peter Zijlstra , Nicolai Stange , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Shuah Khan , Konrad Rzeszutek Wilk , Tim Chen , Sebastian Andrzej Siewior , Mimi Zohar , Juergen Gross , Nick Desaulniers , Nayna Jain , Masahiro Yamada , Joerg Roedel , Linux List Kernel Mailing , live-patching@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [RFC][PATCH] ftrace/x86: Emulate call function while updating in breakpoint handler Message-ID: <20190430150012.58ed382b@gandalf.local.home> In-Reply-To: References: <20190428133826.3e142cfd@oasis.local.home> <20190430135602.GD2589@hirez.programming.kicks-ass.net> <20190430130359.330e895b@gandalf.local.home> <20190430132024.0f03f5b8@gandalf.local.home> <20190430134913.4e29ce72@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 Apr 2019 11:33:21 -0700 Linus Torvalds wrote: > On Tue, Apr 30, 2019 at 10:49 AM Steven Rostedt wrote: > > > > + > > +asm( > > + ".text\n" > > + > > + /* Trampoline for function update with interrupts enabled */ > > + ".global ftrace_emulate_call_irqoff\n" > > + ".type ftrace_emulate_call_irqoff, @function\n" > > + "ftrace_emulate_call_irqoff:\n\t" > > + "push %gs:ftrace_bp_call_return\n\t" > > Well, as mentioned in my original suggestion, this won't work on > 32-bit, or on UP. They have different models for per-cpu data (32-bti > uses %fs, and UP doesn't use a segment override at all). Ah, yeah, I forgot about 32-bit. I could easily make this use fs as well, and for UP, just use a static variable. > > Maybe we just don't care about UP at all for this code, of course. > > And maybe we can make the decision to also make 32-bit just not use > this either - so maybe the code is ok per se, just needs to make sure > it never triggers for the cases that it's not written for.. > > > + "ftrace_emulate_call_update_irqoff:\n\t" > > + "push %gs:ftrace_bp_call_return\n\t" > > + "sti\n\t" > > + "jmp *ftrace_update_func_call\n" > > .. and this should then use the "push push sti ret" model instead. > > Plus get updated for objtool complaints. Yeah, I see that now. Somehow it disappeared when I looked for it after making some other changes. I can update it. > > Anyway, since Andy really likes the entry code change, can we have > that patch in parallel and judge the difference that way? Iirc, that > was x86-64 specific too. Note, I don't think live kernel patching supports 32 bit anyway, so that may not be an issue. Josh, When you come back to the office, can you look into that method? -- Steve