Received: by 10.192.165.148 with SMTP id m20csp19971imm; Thu, 26 Apr 2018 15:07:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+OodVhPLDAvgrMRRXIwmcFzPJqNIWXPysbGReQiD33pdpHRuzTpul/AwFp03IJCi1yjmeZ X-Received: by 10.99.177.5 with SMTP id r5mr28054678pgf.186.1524780475490; Thu, 26 Apr 2018 15:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524780475; cv=none; d=google.com; s=arc-20160816; b=SR05v/FOvscpEgxFBY9PvEoMrdsC1upkEW4tPBMbL6kH4GDTwRPp7eNnz9fR6Wm/Sd onELTvQAJ8cVScwe2GiCWuiEgUQiWGa8QmcQ0m+yDy1/t1KLMRmgrTQaSBIyO1vfv9H8 7wtg8ZcBTm6QVLp9Kt1fMJVaPheBzdxNwD163hqviOJv0RVNQORBGoXioqGAbAcXVRHx tH/kd0H1C78vzjT2Yb32AZTS2rei5GV3EAbHDTOYJCOOOGrzLwEu7dQ4Q64n0ahzSSDl nqZ5MMlHYSoa6HltUo19E3jVHigMQm7Fqw/R7AHuOa9+OmTCSZlMTYsxqoEUkwGj6YdE lwbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=+l0kszWkKPxST+0JgLpYUjSige89hP2uHLbNKxpwkdw=; b=QGN33TnBh9q0/O+g3NXuJf1CiaRTMxzjDwxlKXFsqU7CyIOShMGPy9zdbaIxtXs3WI APQZ/Vtkj1UCr8On6fHkDSQBx5WsDQJjOpSlqFU9/uc6DN/mynZGNuG9eSlVm9jHYVUQ 05PPxtiUBF/CBy9BIGOQSOfBP959gnoX7ed6MfsADBZM7IYnKOoPgKs1/2M8nty1XZPv 9Fq2JRh39ENIrJzXX5LEw5YrKeNlksXfIZhZMkvrovCS7BlxflhlxUJ9/L6SJxAHJTdI boGJEo5Xki61963Vu+NwGSqEeqeSM30gChKlLUpUB99+yjIO8CTwHSAyw7tSGaah3JwM /VgQ== 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 m9si10702580pgn.665.2018.04.26.15.07.40; Thu, 26 Apr 2018 15:07:55 -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; 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 S1756811AbeDZWG3 (ORCPT + 99 others); Thu, 26 Apr 2018 18:06:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59254 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754841AbeDZWG2 (ORCPT ); Thu, 26 Apr 2018 18:06:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 763861529; Thu, 26 Apr 2018 15:06:27 -0700 (PDT) Received: from dupont (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D01BE3F590; Thu, 26 Apr 2018 15:06:26 -0700 (PDT) Date: Thu, 26 Apr 2018 17:06:24 -0500 From: Kim Phillips To: Ganapatrao Kulkarni Cc: , , , , , , , , , Subject: Re: [PATCH v4 2/2] ThunderX2: Add Cavium ThunderX2 SoC UNCORE PMU driver Message-Id: <20180426170624.bfcba885431d57d0de2a3ddd@arm.com> In-Reply-To: <20180425090047.6485-3-ganapatrao.kulkarni@cavium.com> References: <20180425090047.6485-1-ganapatrao.kulkarni@cavium.com> <20180425090047.6485-3-ganapatrao.kulkarni@cavium.com> Organization: Arm X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Apr 2018 14:30:47 +0530 Ganapatrao Kulkarni wrote: > +static int thunderx2_uncore_event_init(struct perf_event *event) ... > + /* > + * SOC PMU counters are shared across all cores. > + * Therefore, it does not support per-process mode. > + * Also, it does not support event sampling mode. > + */ > + if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) > + return -EINVAL; > + > + /* SOC counters do not have usr/os/guest/host bits */ > + if (event->attr.exclude_user || event->attr.exclude_kernel || > + event->attr.exclude_host || event->attr.exclude_guest) > + return -EINVAL; > + > + if (event->cpu < 0) > + return -EINVAL; > + > + pmu_uncore = pmu_to_thunderx2_pmu_uncore(event->pmu); > + > + if (!pmu_uncore) > + return -ENODEV; > + > + /* Pick first online cpu from the node */ > + event->cpu = cpumask_first( > + cpumask_of_node(pmu_uncore->uncore_dev->node)); > + > + if (event->cpu >= nr_cpu_ids) > + return -EINVAL; > + > + if (event->attr.config >= pmu_uncore->uncore_dev->max_events) > + return -EINVAL; > + > + /* store event id */ > + hwc->config = event->attr.config; > + > + /* Validate the group */ > + if (!thunderx2_uncore_validate_event_group(event)) > + return -EINVAL; This PMU driver can be made more user-friendly by not just silently returning an error code such as -EINVAL, but by emitting a useful message describing the specific error via dmesg. Thanks, Kim