From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agf0t-0004FZ-9H for qemu-devel@nongnu.org; Thu, 17 Mar 2016 16:59:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agf0q-0001TK-3o for qemu-devel@nongnu.org; Thu, 17 Mar 2016 16:59:23 -0400 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:32907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agf0p-0001TE-SZ for qemu-devel@nongnu.org; Thu, 17 Mar 2016 16:59:20 -0400 Received: by mail-wm0-x233.google.com with SMTP id l68so43275761wml.0 for ; Thu, 17 Mar 2016 13:59:19 -0700 (PDT) Sender: Paolo Bonzini References: <87wpp4m6n1.fsf@blackfin.pond.sub.org> <20160315133916.GM27203@stefanha-x1.localdomain> <20160315135647.GB11728@work-vm> <20160316182343.GE2012@stefanha-x1.localdomain> <20160316182748.GG2246@work-vm> <20160317112508.GG14062@stefanha-x1.localdomain> <20160317162900.GK5966@work-vm> <56EB03D0.6010209@redhat.com> <56EB1021.5040100@twiddle.net> From: Paolo Bonzini Message-ID: <56EB1AA3.5040305@redhat.com> Date: Thu, 17 Mar 2016 21:59:15 +0100 MIME-Version: 1.0 In-Reply-To: <56EB1021.5040100@twiddle.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] Our use of #include is undisciplined, and what to do about it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , "Dr. David Alan Gilbert" , Stefan Hajnoczi Cc: =?UTF-8?Q?Llu=c3=ads_Vilanova?= , Peter Maydell , qemu-devel@nongnu.org, Markus Armbruster On 17/03/2016 21:14, Richard Henderson wrote: > On 03/17/2016 12:21 PM, Paolo Bonzini wrote: >> That however makes you waste a lot of cache on trace_events_dstate >> (commit 585ec72, "trace: track enabled events in a separate array", >> 2016-02-03). > > I must say I'm not really convinced by that patch, since I don't see that > there's much locality between the ID's that would be polled. There are usually just three-four files in hot paths; they could be kvm-all.c, memory.c, hw/virtio/virtio.c and hw/block/virtio-blk.c for a disk benchmark for example. All tracepoints for a file are adjacent, hence the trace_events_dstate portion that represents one file (assuming that file has <=64 events) costs 1-2 cache lines. Without the patch the footprint of trace_events is 1 cache line for every 2-3 events since sizeof(TraceEvent) == 24. It's true that the patch before 585ec72 also helps removing overhead in the case where all events are disabled (and that's the really common case). That obviously avoids consuming _any_ amount of cache on disabled trace events. However I believe that separate dstate arrays are anyway helpful for David's plan to split the generated tracing headers and avoid world rebuilds. That's because the headers only need the dstate arrays and not the big global arrays. Paolo