Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1433130ybi; Sat, 25 May 2019 01:50:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+0roBmCR3tOSh6epcua1dVNlYQPCRmWmsIbSLh7eptWL/TatqZ0Qz8ruoPejObo9eWuid X-Received: by 2002:a63:d016:: with SMTP id z22mr6139999pgf.116.1558774206114; Sat, 25 May 2019 01:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558774206; cv=none; d=google.com; s=arc-20160816; b=tdQbVgYelBlYrUHSSLgMbtnrqgYrC7deEAZOg60U7ekrVK8o3xxhOOKyltBuHG8VkU x2QnMfGwFZ13mnBPwCNrtTeSp7bGHWJ47dHwmvPtjWQrYzYos1Gfzd1kK4BV+AwM/Nfa u4SIZdLaY6qJQJFV1THZQskkqfYSXTBFhH1hrJNB2a/CaY7N+MxvyO3J7edKoBc7sAAH W872qsxGubdOnF0YQUjqSNy/eMhI1adbQBc3mBPRdurzqPETsQUIy9ba8xJUB0CsiQgS IUESvO4zppIZRpXV/ANGU3rbBc3Ss9A0B3O25Vzt007fX1+ZrDlXfrPxiw3aC7oKuq0h xJIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YtHNbXkR8JRWk1Tkm7eGOHp/N9pmWt1Y/yd2UcLLjio=; b=D98Lloe8BCVKOq7zIwU5tjnzLwHgzayGU8FaTf2Rbl1QVxmAEz0TSrHUW9gvLSTyOX ky26cZ1gaJ0JWtXRsiR5RE1CQN18dxDKHdn6lokwb2RzlN1PTtqK/Lzl3k0cWgpjbSuP ticneHeANpJKhowiz6DCv2waNwQAjHT6UIrwuEPo8pwVAO+p4bUP+D1uoLGDT8mbmlY4 Wz6ZJz6bITEhJhHciKD7tE+mgeUd4Ho3UCYIeuzSB1psqprmPvG2Q41y+2EHLZODPiq8 Bnmq5REHbgElbqSoU4NwtXCREScMJCF+uzUAlHCvxSjHiL60+ijEBxn0KIfI6emD8jSh I0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JQdoHjYs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z124si8283429pfz.93.2019.05.25.01.49.50; Sat, 25 May 2019 01:50:06 -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=fail header.i=@gmail.com header.s=20161025 header.b=JQdoHjYs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726582AbfEYIsO (ORCPT + 99 others); Sat, 25 May 2019 04:48:14 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35666 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfEYIsN (ORCPT ); Sat, 25 May 2019 04:48:13 -0400 Received: by mail-wm1-f67.google.com with SMTP id w9so5174910wmi.0 for ; Sat, 25 May 2019 01:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YtHNbXkR8JRWk1Tkm7eGOHp/N9pmWt1Y/yd2UcLLjio=; b=JQdoHjYszNkd2PYIj4hELUly0wTg/imi9kZkVwciB7yyM50WriIaY5/4oezNW3MSHs Mf/eydrhaHAsUxyvkgtVQyd8SgoL+iB5q/fLhy0pNcBImYFmAbV/I5zA4jNz7C8h0iAD MIMxP6k3gBxzrtxkLwsCsngBBUTZU5tneeHSrQvCcgAykD25hNORB0NtseWYThSf5/Z/ yJMRPsF/JdlCPH8c0loZ4QjpRimj2nZKm2ej/EId8pm8VCK1/vvzpAexr9J+VjtlzBNz LDe/0YOxBP8rfZ3Zab9fk5F6ONaWy20qmM59PTa9LWs7EZ3Zvx+hoJ7S4VL6tqrrbNRU C+Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=YtHNbXkR8JRWk1Tkm7eGOHp/N9pmWt1Y/yd2UcLLjio=; b=KwuGAAB6DDYWdwdmVugusJ/05INg2VG5QS/RgiGt777kxHtrou+cIAlPZAl0pd318v 1M0AOkwSLf8bH1yPisvBqcwWDyYXr8Voe0XA+EKsTwWeJJO3a1vy4v1yM9j9bTgNkHWQ rYcqnZIk3Ol4L9B8sVJ5g1Lm2HnmktstcGldZajG7UOIdNk0kZGioZdHA4DXdyFh2Wp6 afZDTkIKkD7cOj2w/OaOELAeqfvoC5c8/6gjse5sc8gMMC8imv1Uexoe8KSIH7FglJZy JlQG+q3zBHAF2hXE7V6jMuLQ3kzlR61mIxnprqzumZ7PhBNvD9cSyz6VctZe/+e7hiIs 2C7Q== X-Gm-Message-State: APjAAAWOtfuTcJ1e35P3jC6vcvhL7p6zEu1k71rSv8bkKseCEOfaOSXD Yo3oxLEayl6HLIimhOBltJAsOoVx X-Received: by 2002:a1c:cb05:: with SMTP id b5mr2933369wmg.146.1558774091594; Sat, 25 May 2019 01:48:11 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id s11sm8649552wrb.71.2019.05.25.01.48.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 May 2019 01:48:10 -0700 (PDT) Date: Sat, 25 May 2019 10:48:08 +0200 From: Ingo Molnar To: kan.liang@linux.intel.com Cc: vincent.weaver@maine.edu, ak@linux.intel.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, acme@redhat.com, jolsa@redhat.com, eranian@google.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events Message-ID: <20190525084808.GA15802@gmail.com> References: <1558636616-4891-1-git-send-email-kan.liang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1558636616-4891-1-git-send-email-kan.liang@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * kan.liang@linux.intel.com wrote: > @@ -57,6 +57,11 @@ static unsigned int pt_regs_offset[PERF_REG_X86_MAX] = { > #endif > }; > > +u64 non_generic_regs_mask(void) > +{ > + return (~((1ULL << PERF_REG_X86_XMM0) - 1)); > +} > + > u64 perf_reg_value(struct pt_regs *regs, int idx) > { > struct x86_perf_regs *perf_regs; > diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h > index 4767474..c1c3454 100644 > --- a/include/linux/perf_regs.h > +++ b/include/linux/perf_regs.h > @@ -9,6 +9,8 @@ struct perf_regs { > struct pt_regs *regs; > }; > > +u64 non_generic_regs_mask(void); This is a *constant* value, why is it in a separate function, not an inline? Or rather, since it's obviously a constant, name it in such a way. (PERF_REG_X86_NON_GENERIC_MASK or so.) To the generic code define it as 0 if arch headers haven't overriden it. > +u64 __weak non_generic_regs_mask(void) > +{ > + return 0; > +} > + > +static inline bool has_non_generic_regs(struct perf_event *event) > +{ > + u64 mask = non_generic_regs_mask(); > + > + return ((event->attr.sample_regs_user & mask) || > + (event->attr.sample_regs_intr & mask)); 'return' is not a function ... > + /* only support generic regs */ > + if (has_non_generic_regs(event)) > + return -EOPNOTSUPP; In human readable comments please use complete sentences with no unnecessary abbreviations, i.e. "Only support generic registers". Thanks, Ingo