From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25976 invoked by alias); 27 Nov 2012 14:04:04 -0000 Received: (qmail 25870 invoked by uid 22791); 27 Nov 2012 14:04:01 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,TW_LV X-Spam-Check-By: sourceware.org Received: from mga11.intel.com (HELO mga11.intel.com) (192.55.52.93) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Nov 2012 14:03:52 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 27 Nov 2012 06:03:51 -0800 X-ExtLoop1: 1 Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 27 Nov 2012 06:03:50 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.95]) by IRSMSX101.ger.corp.intel.com ([169.254.1.13]) with mapi id 14.01.0355.002; Tue, 27 Nov 2012 14:03:48 +0000 From: "Metzger, Markus T" To: Jan Kratochvil CC: "gdb-patches@sourceware.org" , "markus.t.metzger@gmail.com" , "palves@redhat.com" , "tromey@redhat.com" , "kettenis@gnu.org" Subject: RE: [patch v4 13/13] btrace, x86: restrict to Atom Date: Tue, 27 Nov 2012 14:04:00 -0000 Message-ID: References: <1354013351-14791-1-git-send-email-markus.t.metzger@intel.com> <1354013351-14791-14-git-send-email-markus.t.metzger@intel.com> <20121127130500.GA22431@host2.jankratochvil.net> In-Reply-To: <20121127130500.GA22431@host2.jankratochvil.net> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2012-11/txt/msg00728.txt.bz2 > -----Original Message----- > From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com] > Sent: Tuesday, November 27, 2012 2:05 PM > To: Metzger, Markus T > Cc: gdb-patches@sourceware.org; markus.t.metzger@gmail.com; palves@redhat= .com; tromey@redhat.com; kettenis@gnu.org > Subject: Re: [patch v4 13/13] btrace, x86: restrict to Atom >=20 > On Tue, 27 Nov 2012 11:49:11 +0100, markus.t.metzger@intel.com wrote: > > 2012-11-27 Markus Metzger > > > > * amd64-linux-nat.c (amd64_linux_supports_btrace): New. > > (_initialize_amd64_linux_nat): Change supports_btrace method. > > * i386-linux-nat.c (i386_linux_supports_btrace): New. > > (_initialize_i386_linux_nat): Change supports_btrace method. >=20 > There is i386-nat.c for the common functions between these two files. Is it OK put Linux specific code into i386-nat.c? The cpuid check would be = generic IA but the btrace feature is Linux-only. > > --- a/gdb/gdbserver/linux-x86-low.c > > +++ b/gdb/gdbserver/linux-x86-low.c > > @@ -1859,6 +1859,36 @@ x86_get_min_fast_tracepoint_insn_len (void) > > } > > } > > > > +/* See linux-low.h. */ > > +static int > > +x86_supports_btrace (void) > > +{ > > + unsigned int cpuid, model, family; > > + > > + __asm__ __volatile__ ("movl $1, %%eax;" > > + "cpuid;" > > + : "=3Da" (cpuid) > > + :: "%ebx", "%ecx", "%edx"); >=20 > As Mark Kettenis expressed issue with '__asm__ __volatile__' here and I a= lso > have some uncertainty about its compatibility (*), as it is in linux-* fi= le > anyway I wound find more safe and more common style in GDB to just read a= nd > parse "/proc/cpuinfo", >=20 > (*) Although probably any Linux compiler needst so support it the GCC > compatible way, incl. llvm and icc. I took the __asm__ __volatile__ code from gdb/go32-nat.c. There's similar i= nline assembly code in gdb/gdbserver/linux-tic6x-low.c for checking the cpu= id on that architecture. The go32 code is also checking for features. I'm not sure whether this can = be done by parsing /proc/cpuinfo. I think Marks point is that he does not want any such check in gdb but rath= er have the kernel handle it. He's right that the kernel should handle it. = I just think that gdb needs to handle it, as well. > > + > > + family =3D (cpuid >> 8) & 0xf; > > + model =3D (cpuid >> 4) & 0xf; > > + > > + switch (family) > > + { > > + case 6: > > + model +=3D (cpuid >> 12) & 0xf0; > > + > > + switch (model) > > + { >=20 > Here should be tab, not 8 spaces. Thanks. Fixed. I had this in all three functions. > > + case 28: /* Atom. */ > > + case 38: >=20 > In some instances of this function you list 39 and in other instances you= do > not. Thanks. I added 39. Regards, Markus. Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Peter Gleissner, Christian Lamprechter, Hannes Schwadere= r, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052