Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752290AbbLKTER (ORCPT ); Fri, 11 Dec 2015 14:04:17 -0500 Received: from mail-ig0-f179.google.com ([209.85.213.179]:34075 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbbLKTEQ (ORCPT ); Fri, 11 Dec 2015 14:04:16 -0500 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 11 Dec 2015 12:04:15 -0700 Message-ID: Subject: Re: [PATCH v2 1/1] Fix int1 recursion when no perf_bp_event is registeredy From: Jeff Merkey To: Thomas Gleixner Cc: Andy Lutomirski , LKML , Ingo Molnar , "H. Peter Anvin" , X86 ML , Peter Zijlstra , Andy Lutomirski , Masami Hiramatsu , Steven Rostedt , Borislav Petkov , Jiri Olsa Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1253 Lines: 33 One thing I noticed in this section of code: /* Handle all the breakpoints that were triggered */ for (i = 0; i < HBP_NUM; ++i) { if (likely(!(dr6 & (DR_TRAP0 << i)))) continue; ... snip ... if (bp->hw.info.type == X86_BREAKPOINT_EXECUTE) args->regs->flags |= X86_EFLAGS_RF; rcu_read_unlock(); } Whoever wrote this loop did not seem to understand have observed the code path in action on intel hardware. There is NEVER a case I have seen when the hardware sends multiple breakpoint statuses through dr6, they are sent one at a time. So the rolling check through all the status bits is pointless since only one breakpoint will be reported by the hardware at a time. This is not to say that someone in the future might may change it, but these interrupts are delivered one by one in order and if there are duplicates (like a read/write breakpoint set at the same address as an execute breakpoint. Does anyone know why it was coded this way because its flat wrong. Jeff -- 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/