From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757314AbdCUPmy (ORCPT ); Tue, 21 Mar 2017 11:42:54 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:40741 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932649AbdCUPlh (ORCPT ); Tue, 21 Mar 2017 11:41:37 -0400 Date: Tue, 21 Mar 2017 16:41:22 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, arjan@linux.intel.com, bp@alien8.de, richard.weinberger@gmail.com Subject: Re: [PATCH 1/5] x86: Implement __WARN using UD0 Message-ID: <20170321154122.GT5680@worktop> References: <20170317211918.393791494@infradead.org> <20170317212350.828368979@infradead.org> <20170321140340.urru2lmjko6txwl5@treble> <20170321151446.GV3093@worktop> <20170321153252.ssmrumchartuvy5m@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170321153252.ssmrumchartuvy5m@treble> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 21, 2017 at 10:32:52AM -0500, Josh Poimboeuf wrote: > On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote: > > > > +static int fixup_bug(struct pt_regs *regs, int trapnr) > > > > +{ > > > > + if (trapnr != X86_TRAP_UD) > > > > + return 0; > > > > + > > > > + switch (report_bug(regs->ip, regs)) { > > > > + case BUG_TRAP_TYPE_NONE: > > > > + case BUG_TRAP_TYPE_BUG: > > > > + break; > > > > + > > > > + case BUG_TRAP_TYPE_WARN: > > > > + regs->ip += 2; > > > > + return 1; > > > > > > For self-documentation purposes, maybe use a define for the length of > > > the ud0 instruction? > > > > Well, UD0 and UD2 really. LENGTH_UD0_OR_UD2 is a bit of a fail, name > > wise. > > Why UD2? Warnings are UD0-only, no? What about UD0_LEN? Or at least a > comment would be helpful I think. Oh, right, we only resume on WARN,.. Doh.