Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3619529ybh; Tue, 17 Mar 2020 03:33:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsH+NnnV8zAyAlY4gnkerY6K5ILdIQ0427gEtJz1jGqQbxj3/7J8RkIhdn+si6CZYh/3NeO X-Received: by 2002:aca:abcd:: with SMTP id u196mr2998266oie.86.1584441215451; Tue, 17 Mar 2020 03:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584441215; cv=none; d=google.com; s=arc-20160816; b=XRk1giZ7ZMhbOxO5ruvMq8RDJvYv4qR8+PGrWmVnYqoEq9A4zQaT+IDs989O/wUBzu sfuvC3LHrpEKW6WDLkYiadwFx3ZMy/nMNgH1nL0L+Ti6/37Kh4dLupC6kwgJTbcJ6sde klFIf6xbFLEajk8jctR5jHMwAwugyxYis+5w327+wSN74u7JKLKRNImmgcmxw9Kw6WhT rwaHd9Q6Ucooa4Qp64y9MwErIf/rt8obQHqo4wNEUBjLmCpZkhz8p88xvyvPCTli3gcR Jutb6iJUputjK2oZUz8elsAIu1+qxD9TF0diHA26cjt77bCZF/V60UJbIAZyh7+UWsyC NZeA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=LALR/zxUOMpA80nMDV+tOAog68wf9TQeChna0DpVIP8=; b=AuYFxR1xeog3gVVR2iks2ROYG8qGQrlKZJtm2Ox3Fz/e27KrD4hOBG2Ko47twPyVHh bArrPUQ8kg/uhj2DiobZoBddDGt8y3DadRCV4Sy1FzjsJInfaUH8OzCiZEZBC8s7I4uP farE4Wc7kRJ6iDrz5V4vrCn0zY4DSDoS9FKgCARNrwAL+OSNp5dIUvPfh67oQ31E349F U0/l1b31+FdAHb3EBXT8BhkphF1Pp4Oh6rD2Y1pEf3nbcaHgSkmuM+lV4hFnDKXMMUrS D3WGMw5aDr+zNl57H+kAmI8GIUsKSBf6Cx59UITTjCYa0hG0/WMZ6KfLAwEoQdUV9CZC W/cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=Y+uImdpO; 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 l11si1564221otk.207.2020.03.17.03.33.23; Tue, 17 Mar 2020 03:33:35 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=Y+uImdpO; 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 S1726130AbgCQKcd (ORCPT + 99 others); Tue, 17 Mar 2020 06:32:33 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:20861 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbgCQKcc (ORCPT ); Tue, 17 Mar 2020 06:32:32 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48hTy568mKz9tyN5; Tue, 17 Mar 2020 11:32:29 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=Y+uImdpO; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id G4YSIjMRBAsW; Tue, 17 Mar 2020 11:32:29 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48hTy54mPkz9tyMf; Tue, 17 Mar 2020 11:32:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584441149; bh=LALR/zxUOMpA80nMDV+tOAog68wf9TQeChna0DpVIP8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Y+uImdpOvm80NjoOw1hEYQrZcmt+o0TWNpcdCxyqdIAy1AL3LIaurar0P8a7WyDTq YDoaSdJ7NeRE5po/9Dr1T+x00Z7KyaYpRFrbxRdTtAphwtzMCMm6o12qVSYW2SSyU7 gObKIQhEuY7D2bej98VXXok6IRKA687LdQKsaovw= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7E71E8B786; Tue, 17 Mar 2020 11:32:30 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id iCLhs1qlnk3o; Tue, 17 Mar 2020 11:32:30 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1DB818B785; Tue, 17 Mar 2020 11:32:28 +0100 (CET) Subject: Re: [PATCH 07/15] powerpc/watchpoint: Get watchpoint count dynamically while disabling them To: Ravi Bangoria , mpe@ellerman.id.au, mikey@neuling.org Cc: apopple@linux.ibm.com, paulus@samba.org, npiggin@gmail.com, naveen.n.rao@linux.vnet.ibm.com, peterz@infradead.org, jolsa@kernel.org, oleg@redhat.com, fweisbec@gmail.com, mingo@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20200309085806.155823-1-ravi.bangoria@linux.ibm.com> <20200309085806.155823-8-ravi.bangoria@linux.ibm.com> From: Christophe Leroy Message-ID: Date: Tue, 17 Mar 2020 11:32:26 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200309085806.155823-8-ravi.bangoria@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 09/03/2020 à 09:57, Ravi Bangoria a écrit : > Instead of disabling only one watchpooint, get num of available > watchpoints dynamically and disable all of them. > > Signed-off-by: Ravi Bangoria > --- > arch/powerpc/include/asm/hw_breakpoint.h | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h > index 980ac7d9f267..ec61e2b7195c 100644 > --- a/arch/powerpc/include/asm/hw_breakpoint.h > +++ b/arch/powerpc/include/asm/hw_breakpoint.h > @@ -75,14 +75,13 @@ extern void ptrace_triggered(struct perf_event *bp, > struct perf_sample_data *data, struct pt_regs *regs); > static inline void hw_breakpoint_disable(void) > { > - struct arch_hw_breakpoint brk; > - > - brk.address = 0; > - brk.type = 0; > - brk.len = 0; > - brk.hw_len = 0; > - if (ppc_breakpoint_available()) > - __set_breakpoint(&brk, 0); > + int i; > + struct arch_hw_breakpoint null_brk = {0}; > + > + if (ppc_breakpoint_available()) { I think this test should go into nr_wp_slots() which should return zero when no breakpoint is available. This would simplify at least here and patch 4 Christophe > + for (i = 0; i < nr_wp_slots(); i++) > + __set_breakpoint(&null_brk, i); > + } > } > extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); > int hw_breakpoint_handler(struct die_args *args); >