Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1605740
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/5] x86: Implement __WARN using UD0 |
| Date | 2017-03-21 16:40 +0100 |
| Message-ID | <tnu38-5ee-15@gated-at.bofh.it> (permalink) |
| References | <tm7Lj-4jK-7@gated-at.bofh.it> <tm7Lj-4jK-15@gated-at.bofh.it> <tnsNI-4r2-5@gated-at.bofh.it> <tntJN-55L-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote:
> > to WARN, they should probably be renamed to describe their new purpose,
> > like:
> >
> > "report_bug" -> "report_bug_or_warning"
> > "fixup_bug" -> "fixup_bug_or_warning"
> >
> > On a related note, if warn and bug are going to continue to use two
> > separate ud instructions for the foreseeable future, report_bug() could
> > be cleaned up a bit: e.g., for a ud0 instruction, it doesn't make sense
> > to call find_bug().
>
> I'm sure you'll break $random arch if you go futz with that. Also, I
> think you mean UD2, since that's BUG. We actually need the bug_entry for
> WARNs (aka UD0).
>
> Also, you're now optimizing the BUG() code; I don't think anybody cares
> about saving a few cycles there. It shouldn't happen in the first place.
My thinking was to make report_bug() a little less obtuse, but yeah,
that would break other arches, so never mind...
> > > +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.
--
Josh
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] x86 optimizations Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
[PATCH 3/5] atomic: Introduce atomic_try_cmpxchg() Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
[PATCH 5/5] x86,atomic: Use atomic_try_cmpxchg Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
[PATCH 1/5] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-21 15:20 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Arjan van de Ven <arjan@linux.intel.com> - 2017-03-21 16:20 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-21 16:40 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-03-21 16:50 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-03-21 17:50 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-03-22 09:50 +0100
Re: [PATCH 1/5] x86: Implement __WARN using UD0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-22 15:20 +0100
[PATCH 4/5] refcount: Use atomic_try_cmpxchg() Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
[PATCH 2/5] bug: Add _ONCE logic to report_bug() Peter Zijlstra <peterz@infradead.org> - 2017-03-17 22:40 +0100
csiph-web