Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1040528rdb; Fri, 9 Feb 2024 08:32:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWsrL5PFjX4fb2pAUL0caffMbtFsjYB/EPJzMgcZcjKunguNpcLBAANoWK0n67BiPY8sQ9r6XbN79KdluTPSAIQicNU7Ikm6XWOxiSwzQ== X-Google-Smtp-Source: AGHT+IFUM7bx8PSofOlntap062T99oSlf4+4VPw0wYKFHwfoKvgVTOqeJZtMtwscj5QyWKNZmjsE X-Received: by 2002:a17:902:ce90:b0:1d9:b3d7:fc44 with SMTP id f16-20020a170902ce9000b001d9b3d7fc44mr2449173plg.22.1707496370058; Fri, 09 Feb 2024 08:32:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707496370; cv=pass; d=google.com; s=arc-20160816; b=EH0K+i+Lsz40rydhBrKMg1Y1BnOTvvZ4wH6hb8vhZkc5KyAA9ccDFcuUNRGekvyiZK t9bAwk7tYkDu1qX9Iw+wjMt7rLg6ajW4nbiqmkmAbYrv8h0Vl38TE7qYRUTbyEJvUGLy l1pTmjbLhy0OrBRG2Go6e4AMwsXCjBaxcuyyKQGuYiiLRQpvUg17z2qB+XFJqglAPCQc FSOyYHwapX10DM+lyB1aazBzAIGx88+XjT/00cT1ROgUknC2jwVzyHS3bQDrudW98GHa PBdvdOQy5fJ65WJyYlEpy9psbNr4/raC/HYVBRi60A3I0NxX+uwzLxM2LDeo0eM8jhaY DLeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=ok1MIhfXWnQRUao84gAYX3i3E8i5wC32P4PHQpACo7U=; fh=Atvo1YMcrfoxhkfmOLiQvlOXw+EkDFHRtGCHmx75bpA=; b=xLYmIXGhCEazpIpyQTdRoYVH0BnudGcpUTahXvYCwjI9tfXBtLVflYNd5uCDbRGk94 rDyV+h0Y5/GgBBQ05qpuD1t4Z/Esb2mM0ggOCfydQqdMss+fK5VWTCTl+zI1oK0f7VcL Ndz1ztKuzHyCcFXry1ZIQU3xZ5HmDeMbXQ/r89tsgfbHGx3lZgjWE7c7rQrGbzlYBhmP ZeWLeQLQRgsrEaa61SPXd36T9MIDwz/+wlGJgjg+6tbHnC6wecEJ1nXCjgZhaOkuF9CW CtOb6KGXhCQI80gAPyK+FxUOb7la0j/iZIeSotwopDRVOSMCoCY6tUfV8HZo1hLNWyXj he6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-59607-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59607-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCVhrSKeYn+LmnIEuADcjMbEb1eG0A9UYR+5KqXkFQGZMZfNaOyNwnUuH7STyFbhltLFqNkEISS4mGVIz4+5mxfHbA6NJ8Y7bwbm2s4syQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l7-20020a170903244700b001d9871e4dabsi1950276pls.101.2024.02.09.08.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 08:32:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59607-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-59607-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59607-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B13E2871B2 for ; Fri, 9 Feb 2024 16:32:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10F9571B2F; Fri, 9 Feb 2024 16:32:06 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52C485221 for ; Fri, 9 Feb 2024 16:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496325; cv=none; b=sxd37Ck8tLJc4w1nollUnnLMVJPZgqUGfRK3trjvSEX8xr0phOA4wuiwBUZ8+kF8TQV5yMdx8NyA7SWVcbPybqkHLUGiza3gSy22w7l/7TCBXBCerZ81gaqtKKmJteQ6dIL9j+lbc/TOi+6Yg+39cHNss+wDRN7B6qe0Oq2jhFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707496325; c=relaxed/simple; bh=GS1JvHViUXwToGjn+4dF2502dOYIGWp1Karb3Lg3yYo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HKNp9sOtequGx99L3IwzxwjQHNBE+znbahwrC/U6mEMIkrfBVMGK5b6ZBxTl8wX1g5DAz7SH10ahdYhYDHpI0yJ6U1C6+hpv8UODtXAMcopQpnP3Mb/sHFpDJnQ7JXMqW3uEf84fbc2auMr1Cbrk21fceSMHCYNdV0+wLz80mVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8DD24DA7; Fri, 9 Feb 2024 08:32:44 -0800 (PST) Received: from [10.57.47.119] (unknown [10.57.47.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FC313F5A1; Fri, 9 Feb 2024 08:32:01 -0800 (PST) Message-ID: Date: Fri, 9 Feb 2024 16:32:00 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf/arm_smmuv3: Omit the two judgements which done in framework Content-Language: en-GB To: Will Deacon , "JiaLong.Yang" Cc: Mark Rutland , shenghui.qu@shingroup.cn, ke.zhao@shingroup.cn, zhijie.ren@shingroup.cn, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231221093802.20612-1-jialong.yang@shingroup.cn> <20240209160905.GA24565@willie-the-truck> From: Robin Murphy In-Reply-To: <20240209160905.GA24565@willie-the-truck> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-02-09 4:09 pm, Will Deacon wrote: > On Thu, Dec 21, 2023 at 05:38:01PM +0800, JiaLong.Yang wrote: >> 'event->attr.type != event->pmu->type' has been done in >> core.c::perf_init_event() ,core.c::perf_event_modify_attr(), etc. >> >> This PMU is an uncore one. The core framework has disallowed >> uncore-task events. So the judgement to event->cpu < 0 is no mean. > > It would be great to refer to the changes which added those checks to > the perf core code. From reading the code myself, I can't convince myself > that perf_try_init_event() won't call into the driver. > >> >> The two judgements have been done in kernel/events/core.c >> >> Signed-off-by: JiaLong.Yang >> --- >> drivers/perf/arm_smmuv3_pmu.c | 8 -------- >> 1 file changed, 8 deletions(-) > > It looks like _many_ perf drivers have these checks, so if they really > aren't needed, we can clean this up bveyond SMMU. However, as I said > above, I'm not quite convinced we can drop them. Right, I think the logic prevents events with a specific PMU type being offered to other PMUs, but as far as I'm aware doesn't apply the other way round to stop generic events (PERF_TYPE_HARDWARE etc.) being offered to all PMUs, so it's those that system PMUs need to reject. It's been on my wishlist for a long time to have a capability flag to say "I don't handle generic events, please only ever give me events of my exact type" so we *can* truly factor this into the core. Thanks, Robin.