From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54562 invoked by alias); 16 Aug 2018 16:51:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 54538 invoked by uid 89); 16 Aug 2018 16:51:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=machado, Machado, Edjunior, U*emachado X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Aug 2018 16:51:26 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B35081663F6; Thu, 16 Aug 2018 16:51:24 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17B952156714; Thu, 16 Aug 2018 16:51:22 +0000 (UTC) Subject: Re: [PATCH v4 10/12] [PowerPC] Add support for EBB and PMU registers To: Pedro Franco de Carvalho , gdb-patches@sourceware.org References: <20180815000608.26840-1-pedromfc@linux.ibm.com> <20180815000608.26840-11-pedromfc@linux.ibm.com> Cc: uweigand@de.ibm.com, edjunior@gmail.com From: Pedro Alves Message-ID: <5c9f286a-8289-7984-c256-d19af8f797b5@redhat.com> Date: Thu, 16 Aug 2018 16:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180815000608.26840-11-pedromfc@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-08/txt/msg00402.txt.bz2 On 08/15/2018 01:06 AM, Pedro Franco de Carvalho wrote: > From: Edjunior Barbosa Machado > > This patch adds support for registers of the Event Based Branching and > Performance Monitoring Units for the powerpc linux native and core > file targets, and for the powerpc linux server stub. > > All three EBB registers are accessible. Only a subset of the PMU > registers can be accessed through ptrace. Because of this, the PMU > registers are enumerated individually in gdbarch_tdep, as opposed to > having a single "have_pmu" flag. This is intended to make it easier > to add additional PMU registers in the future, since checking a > "have_pmu" flag elsewhere in the code would no longer be correct. The > tdesc feature is named org.gnu.gdb.power.linux.pmu because of this. > > It's unclear if it makes sense to save and restore these registers > across function calls, since some of them can be modified > asynchronously. They are also not tracked in record-replay mode. > > The kernel can return ENODATA when ptrace is used to get the EBB > registers, unless a linux performance event that uses EBB is open in > the inferior. For this reason, the "fill" functions in the server > stub for the ebb register sets is not implemented. > > Since gdbserver writes all registers in one go before resuming the > inferior, this error would not be detected at the time the user tries > to write to one of the registers on the client side, and gdbserver > would print out warnings every time it resumes the inferior when no > ebb performance event is opened, so there is currently no > straightforward way to handle this case. This means the ebb registers > in the client-side regcache can become dirty when the user tries to > write to them, until the inferior is resumed and stopped again. Should we make gdbserver flush the regcache after handling 'G' and 'P' packets? > > Another limitation for the ebb registers is that traceframes don't > record if registers are available or not, so if these registers are > collected when a tracepoint is hit and the inferior has no ebb event > opened, the user will see zero values for all of them, instead of the > usual . That'd be nice to fix somehow, at some point. Thanks, Pedro Alves