From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755933AbdKNTKk (ORCPT ); Tue, 14 Nov 2017 14:10:40 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:50872 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754251AbdKNTKd (ORCPT ); Tue, 14 Nov 2017 14:10:33 -0500 X-Google-Smtp-Source: AGs4zMYtazoHQFqzqPGBticDmA/Q5WIkzNznJJ3948gQW8/J9ohhgXcSn7GKkKJMig5hh91Au70rlw== Date: Tue, 14 Nov 2017 11:10:23 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Dave Hansen cc: Peter Zijlstra , linux-kernel@vger.kernel.org, linux-mm@kvack.org, hughd@google.com, moritz.lipp@iaik.tugraz.at, daniel.gruss@iaik.tugraz.at, michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, x86@kernel.org Subject: Re: [PATCH 18/30] x86, kaiser: map virtually-addressed performance monitoring buffers In-Reply-To: <30655167-963f-09e3-f88f-600bb95407e8@linux.intel.com> Message-ID: References: <20171110193058.BECA7D88@viggo.jf.intel.com> <20171110193139.B039E97B@viggo.jf.intel.com> <20171114182009.jbhobwxlkfjb2t6i@hirez.programming.kicks-ass.net> <30655167-963f-09e3-f88f-600bb95407e8@linux.intel.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 Nov 2017, Dave Hansen wrote: > On 11/14/2017 10:20 AM, Peter Zijlstra wrote: > > On Fri, Nov 10, 2017 at 11:31:39AM -0800, Dave Hansen wrote: > >> static int alloc_ds_buffer(int cpu) > >> { > >> + struct debug_store *ds = per_cpu_ptr(&cpu_debug_store, cpu); > >> > >> + memset(ds, 0, sizeof(*ds)); > > Still wondering about that memset... Sorry, my attention is far away at the moment. > > My guess is that it was done to mirror the zeroing done by the original > kzalloc(). You guess right. > But, I think you're right that it's zero'd already by virtue > of being static: > > static > DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED(struct debug_store, > cpu_debug_store); > > I'll queue a cleanup, or update it if I re-post the set. I was about to agree, but now I'm not so sure. I don't know much about these PMC things, but at a glance it looks like what is reserved by x86_reserve_hardware() may later be released by x86_release_hardware(), and then later reserved again by x86_reserve_hardware(). And although the static per-cpu area would be zeroed the first time, the second time it will contain data left over from before, so really needs the memset? Hugh