Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp990743imm; Mon, 9 Jul 2018 14:48:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd/++AL5gmSsuKCTvuj37+2TuNZxXjbpp9JffSON4irWc4DQcJ1ZiPW63wghJl6sylpzde6 X-Received: by 2002:a65:4cc5:: with SMTP id n5-v6mr15587770pgt.451.1531172882509; Mon, 09 Jul 2018 14:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531172882; cv=none; d=google.com; s=arc-20160816; b=SDvpXlFvFcMW6njfl7LjberjpJl01SbhzRjliNOZLj13t+L71MNX9fq+GF+DUosllo XPv5k9wHwFt9SBsmSmoInGsqnyZIHK4uc23tpjhjWGYA4uK4Bno+5+gLrFy2h15V6VPH 3MlK5SYAWb2kKY+Vs7j8/DLUdrNgu+Vxukeox39TKms2RY8wVE6Lso6VQSAoNwfoO4cD haAZjl3/5j4JAxS8JLTyc1db5qNHxrLi7kFgVI++2iZBNezSCMLn1O3jJjt3OAgzu2Na Assx8gobii2Qo1gzNNcQkHwJaOvR/OhROz2faQb7Wv8FzNTA6z4y58cmfKr1a14RUq5Q qT1A== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=myIBQYp6xEsSyR8zr6XOO90C6k+eMKk08UYvtZiZE0s=; b=t7irXOVw4ArnvyAtjUeAwCSbZBM/9fnSHPEfHJhX47dMbAQIfCXvSWdPby1lAMiqSy t/w9oifzH+R+7Zi17Uw2O69RU9S6+f2n9E3n9rdXL2kVZc2CNgnqW5NUJbkLVPqKOUgH PEV3IHXQjdRnA0hYIj5bleV0revTc3kzWvtDW0RENXs4stTaBG4RNmt8EZDVn77QPw/r e6GwRdTR2mxWUf9kDMTTBPH8EVfjUH2uL189UseNVLLte3iH7Y7bRN3CR/f9IakXXdZG IWHv9rJP8QgeB4gu0VOnp69lfJhgKL/UrPDSydgUayqoEAJ+BdywTjurVpFOlPoczWjZ huTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VPfcZnwz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g131-v6si14560050pgc.204.2018.07.09.14.47.46; Mon, 09 Jul 2018 14:48:02 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=VPfcZnwz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933357AbeGIVpb (ORCPT + 99 others); Mon, 9 Jul 2018 17:45:31 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41264 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933138AbeGIVp3 (ORCPT ); Mon, 9 Jul 2018 17:45:29 -0400 Received: by mail-ed1-f67.google.com with SMTP id b12-v6so15059180edt.8 for ; Mon, 09 Jul 2018 14:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=myIBQYp6xEsSyR8zr6XOO90C6k+eMKk08UYvtZiZE0s=; b=VPfcZnwzGq58W3QPfvoU4XobNj6m4pjcy4tikSY4Ya6N2qm/YWkcVflhuXr+z5jZI7 qbbnyfOdyWQOb68Nb1TOsjKG+8MtGv+YNHNJ8honftQ+rCozbPuI2AaWI5mMjmQ1szCa BN44SGE459nVVIeBXB4E3G/9mYr4A+uB4k+x0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=myIBQYp6xEsSyR8zr6XOO90C6k+eMKk08UYvtZiZE0s=; b=m2CIR2Yl405mFay6kpjL2JqDy82N7Oehii+lCEUagAFrO7WkTC/uiTtSw3mLID5rwW 7OPKB71+0/Jmm1mX1kEH3PANfnPPzSRw2OcQ0mE4xUKLEyNExWiqXl+gnnHNJzKbXxNV mvjUj5mpR9+DbWeUpe92zin4dkV7PfTx0e6iqan4haHmcp0jBRT8XbYo9tkNHTHkSRYr SFfnf74kfKotv5MK/FmDj/Bhsi2fnGhxYXAGb2sNMMRXkd4BukLV2OooWDWF3L8nP4FG beFrJ4QDo8GGnJQWb6atkX+thqqmIkl4AL/IyFqiYJDN/oskj7Dh+gmyZAysKxnW+1EX V1Zg== X-Gm-Message-State: APt69E0PL4v4f64gBsUvt4DPzP4BOpuAdY0XSGnxMWdAJTuvQHN3uLXT YJGzKX3BVti1b317eG0Mz9i6p+e1basmWPvrWyX/fQ== X-Received: by 2002:a50:b613:: with SMTP id b19-v6mr24064919ede.255.1531172728631; Mon, 09 Jul 2018 14:45:28 -0700 (PDT) MIME-Version: 1.0 References: <1530828827-11604-1-git-send-email-mathieu.poirier@linaro.org> <1530828827-11604-3-git-send-email-mathieu.poirier@linaro.org> <20180706182222.8af97a96d613c90415cb202f@arm.com> In-Reply-To: From: Mathieu Poirier Date: Mon, 9 Jul 2018 15:45:17 -0600 Message-ID: Subject: Re: [PATCH v2 2/7] perf/core: Use ioctl to communicate driver configuration to kernel To: Kim Phillips Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Mark Rutland , linux-s390@vger.kernel.org, Alexander Shishkin , Will Deacon , "H. Peter Anvin" , heiko.carstens@de.ibm.com, Adrian Hunter , ast@kernel.org, Ingo Molnar , linux-arm-kernel , Greg KH , schwidefsky@de.ibm.com, Namhyung Kim , Thomas Gleixner , Jiri Olsa , Linux Kernel Mailing List 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 Mon, 9 Jul 2018 at 10:49, Mathieu Poirier wrote: > > On Fri, 6 Jul 2018 at 17:22, Kim Phillips wrote: > > > > On Thu, 5 Jul 2018 16:13:42 -0600 > > Mathieu Poirier wrote: > > > > Hi Mathieu, > > > > > This patch adds the mechanic needed for user space to send PMU specific > > ^^^^^^^^ > > I think you meant 'mechanism' here: mechanics fix cars :) > > I really meant "mechanic", as in "functional details or procedure" [1] > > [1]. https://www.merriam-webster.com/dictionary/mechanics > > > > > > +static void perf_drv_config_replace(struct perf_event *event, void *drv_data) > > > +{ > > > + unsigned long flags; > > > + void *old_drv_data; > > > + struct pmu_drv_config *drv_config = &event->hw.drv_config; > > > + > > > + if (!has_drv_config(event)) > > > + return; > > > + > > > + /* Children take their configuration from their parent */ > > > + if (event->parent) > > > + return; > > > + > > > + /* Make sure the PMU doesn't get a handle on the data */ > > > + raw_spin_lock_irqsave(&drv_config->lock, flags); > > > + > > > + old_drv_data = drv_config->config; > > > + drv_config->config = drv_data; > > > + > > > + raw_spin_unlock_irqrestore(&drv_config->lock, flags); > > > + > > > + /* Free PMU private data allocated by pmu::drv_config_validate() */ > > > + event->pmu->drv_config_free(old_drv_data); > > > +} > > > > I got this stacktrace whilst testing a perf tool *without* this series > > applied, running on a kernel *with* this series applied: > > That shouldn't matter as I kept the changes backward compatible > specifically to handle this situation. > > > > > [ 132.942054] INFO: trying to register non-static key. > > [ 132.946964] the code is fine but needs lockdep annotation. > > [ 132.952389] turning off the locking correctness validator. > > [ 132.957818] CPU: 2 PID: 2835 Comm: perf64-sans Not tainted 4.18.0-rc3-00196-g5b5d957532a8-dirty #146 > > [ 132.966856] Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno Development Platform, BIOS EDK II Jan 23 2017 > > [ 132.977527] Call trace: > > [ 132.979947] dump_backtrace+0x0/0x1c0 > > [ 132.983567] show_stack+0x24/0x30 > > [ 132.986845] dump_stack+0x90/0xb4 > > [ 132.990122] register_lock_class+0x57c/0x580 > > [ 132.994343] __lock_acquire.isra.12+0x6c/0x980 > > [ 132.998736] lock_acquire+0x100/0x1e8 > > [ 133.002357] _raw_spin_lock_irqsave+0x58/0x78 > > [ 133.006667] perf_drv_config_replace+0x4c/0x80 > > [ 133.011061] _free_event+0xbc/0x460 > > [ 133.014507] put_event+0x2c/0x38 > > [ 133.017697] perf_event_release_kernel+0x1ac/0x300 > > [ 133.022434] perf_release+0x10/0x20 > > [ 133.025883] __fput+0xa8/0x1e0 > > [ 133.028901] ____fput+0x20/0x30 > > [ 133.032006] task_work_run+0xa0/0xd0 > > [ 133.035539] do_notify_resume+0x118/0x120 > > [ 133.039503] work_pending+0x8/0x10 > > > > Is a raw_spin_lock_init missing perhaps? I read your email too fast... That's exactly what it was. Thanks for giving this a spin, Mathieu > > Not that I can tell - I need to investigate. > > > > > Thanks, > > > > Kim