Received: by 10.223.164.202 with SMTP id h10csp91944wrb; Tue, 14 Nov 2017 11:40:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZwlbmROqJcNRKE5JAYOJsafc9jaW7QcGZmuoIsFFsFLdvLKjkaqKbzrngDfdnhtYAPMv6K X-Received: by 10.98.74.206 with SMTP id c75mr15109286pfj.100.1510688408500; Tue, 14 Nov 2017 11:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510688408; cv=none; d=google.com; s=arc-20160816; b=DUdnkowXFx+yD4kaGFsOfYYjxQTgQvhFoOeFzDb39GdRF55JXbqwEzZ5M/sosjBwsG sEkSLQeq0B8n8B2q1/Ez1KZqU5xLYR8MVOovSagVQXyHe8tSPLa0gsmbwRwFSAJ7oUPz rD6yKE3ExI1MBfyloUUhMpZDLStth6LI5zSnMNkxx9WodJXkPHLUNqec68JDpwq/VpWe wIIvVtKkR4w/vB5UqDx52caMenH/i9f4vvFhoZG3bhKS/GYqTL6fIPV1d983CcVgiRSh 1hraKO5XmToy1UG7GudlRJS7M01QibXevfGojtQX/TS1hM7kMLrpv3QAAvsby5RZrPaj DBNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=aSnGF5huydyyq1xH4upQTmo6HbCv1RIcl/XcTBHHurU=; b=0rYSEqzMNTHfVvKAafRno32bs3sPlf2l3Du5mEJsT61R9L8tC3NZr7ABXSCXd7EakU VS9KkeOfEKSIQ5p/SD5DyHmiVs4Cc3CQTYtZuufzD1SrbMseFq5xx0dar9xexzMiQkwQ WQ8bED6xPYI6ltiZ1+CDiShka6DcovKJ5WHKhb+pmiqkGw0wNyxSXjeKXFXXlLdiWPEc S16aHnm8B+00E7w5SF7iYQbopotj05rfPFyboU+/kYePKvFJvXV7nUqYGKJjqZJEDAjC 82ldIhri2t888xfnJxTxXkS5VLg/BNen5A+WHPo4yG1dOKw88LJXAAGZGtBSTfGrDqtu uPLA== ARC-Authentication-Results: i=1; mx.google.com; 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 b5si15763569pgc.137.2017.11.14.11.39.56; Tue, 14 Nov 2017 11:40:08 -0800 (PST) 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; 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 S1756218AbdKNTYp (ORCPT + 88 others); Tue, 14 Nov 2017 14:24:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:44888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637AbdKNTYi (ORCPT ); Tue, 14 Nov 2017 14:24:38 -0500 Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B7C2521879 for ; Tue, 14 Nov 2017 19:24:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7C2521879 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=luto@kernel.org Received: by mail-it0-f43.google.com with SMTP id y15so14966986ita.4 for ; Tue, 14 Nov 2017 11:24:37 -0800 (PST) X-Gm-Message-State: AJaThX7lwzViQfb0aHrwbSgMACTPIw3b7fXxKdx6KcY4ZbOc5H7gMmWu HVPa0+BI1sZJpF2sekoCYGsxIkjXuZX7QXvOq4sxsg== X-Received: by 10.36.29.19 with SMTP id 19mr15090536itj.86.1510687477209; Tue, 14 Nov 2017 11:24:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.10.70 with HTTP; Tue, 14 Nov 2017 11:24:16 -0800 (PST) In-Reply-To: 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> From: Andy Lutomirski Date: Tue, 14 Nov 2017 11:24:16 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/30] x86, kaiser: map virtually-addressed performance monitoring buffers To: Hugh Dickins Cc: Dave Hansen , Peter Zijlstra , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , moritz.lipp@iaik.tugraz.at, Daniel Gruss , michael.schwarz@iaik.tugraz.at, richard.fellner@student.tugraz.at, Andrew Lutomirski , Linus Torvalds , Kees Cook , X86 ML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 14, 2017 at 11:10 AM, Hugh Dickins wrote: > 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? > For an upstream solution, I would really really like to see DEFINE_PER_CPU_SHARED_ALIGNED_USER_MAPPED and friends completely gone and to use cpu_entry_area instead. I don't know whether this has any material impact on this particular discussion, though. --Andy > Hugh From 1584069890973618596@xxx Tue Nov 14 19:12:50 +0000 2017 X-GM-THRID: 1583708990616525039 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread