Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp484477pxu; Fri, 11 Dec 2020 07:03:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWbco6cXJPqGy0F7X8QZX5e6jlpqxvbL0Px2zR03qPFTOL19Qz+/B1LbYuPNQ7kUG9FvYM X-Received: by 2002:a17:906:298c:: with SMTP id x12mr11294004eje.244.1607699001990; Fri, 11 Dec 2020 07:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607699001; cv=none; d=google.com; s=arc-20160816; b=PiyoD0KE8UGbPCTI5sx6kjQGZYv2iifRZEokTKuabIsnZxqvHwn4nxu0x1uEaU3AL9 BBwoIyEyPnw8tHlYfmw9AOwPbHO15uZcRv+SPomBSwCKSv60gKKVeteOBWDiZbZX2YdL GCBK/bExgG53Oq9vkNoE/b8i0qhiQxoarwUREggo30Ypl+ohyZWHWB/fJV8jyE/vl46T Dh+/O784nZmHYrG8Sz4An3W30Wo3cIpz5WFnKgLtPEMGdeg8Qtlezq8f/DPyBB4HSd3c 1gGFAXhBGEQhD7kP/HzVQrmLVYGmxUt4C2vIBM8Vx76t6OVatYKgvGIctDhBvSb38Bty 7xiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=tedn7ymzbpjBuwONM7mrejLqIAj0SfIl9BNyEo5uI8Y=; b=lQPOFNFiEpFdTC6Ji2ehT1fq+5jVCmSuJNIy5niTigPxCdmNP7M68jiolQLv4k1Mca K7N8M7GvDqUE2rAvPEHE5ymEEgJuTgWIr6Pk4tnyWjLzKBhfjFg17ODjIkneWga9psby RTAwNP7ajP2+cK4A2usKQh9fkv7m1aTIiIvfWuvxZhQRcl5hVBN/EK3vdjF1j5U3az6m wBFwstw0WK0pLwajJJHu5fEJNO3rQAB7US8Z/gNU0VdBuxTUzQ4JH2W7yYKrkMd/YwQk EDVv4GL0JKa7WeKk13g/FJSY4cqLzr3g+acN87bMNLPb6Ij3UaHCfLCeQYj3n0j7tmx5 AIwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KSh5MFgK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=j3pyJVh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df20si4882063edb.366.2020.12.11.07.02.53; Fri, 11 Dec 2020 07:03:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KSh5MFgK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=j3pyJVh6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391268AbgLJQgx (ORCPT + 99 others); Thu, 10 Dec 2020 11:36:53 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:54896 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387497AbgLJQga (ORCPT ); Thu, 10 Dec 2020 11:36:30 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607618146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tedn7ymzbpjBuwONM7mrejLqIAj0SfIl9BNyEo5uI8Y=; b=KSh5MFgKhKV2r++wKQZfsUKt7eCfO/xJn6HjBp4Nglh9z5HFvTcfcLDksgQz0sGXAP7hqf nLCCQoI9DObj4QYOPCpfXgLJGflGvvhjGLT27w0BqrDI5I84IRLRjwjGOAFWxpjXwscPB2 Y6gEwAVllaW1m7ib4fV5KVDXGI4cVA9jedNYzURdIzPE1wnLVzorfHM4qUln87EXe5Bsb0 6+nTg1coMHAexhAIxt3odg8QXMDU2app2/gCYQG8sQymCxFm83NhYUdOZ3+oZ2TojeStIa sCSQEkcoGTBecC3pHY/OOJ5f0eXU9U8WUvqYkPmDzOOR4/DceEQFJiUycAMaig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607618146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tedn7ymzbpjBuwONM7mrejLqIAj0SfIl9BNyEo5uI8Y=; b=j3pyJVh6vB5Rn5BUoY8WosYAfGOnLLmOr8onRpTOw1D0awi2VezrJSrbi6GPfNbIwXIaOL mxLB6fFc/8WJ3yBg== To: Tvrtko Ursulin , Joonas Lahtinen , Jerry Snitselaar , linux-kernel@vger.kernel.org, Tvrtko Ursulin , Chris Wilson Cc: Jason Gunthorpe , Peter Zijlstra , intel-gfx@lists.freedesktop.org, Matthew Garrett , James Bottomley , David Airlie , Jarkko Sakkinen , dri-devel@lists.freedesktop.org, linux-integrity@vger.kernel.org, Peter Huewe Subject: Re: [Intel-gfx] [PATCH v3 2/4] drm/i915/pmu: Use kstat_irqs to get interrupt count In-Reply-To: References: <20201205014340.148235-1-jsnitsel@redhat.com> <20201205014340.148235-3-jsnitsel@redhat.com> <875z5e99ez.fsf@nanos.tec.linutronix.de> <160758677957.5062.15497765500689083558@jlahtine-mobl.ger.corp.intel.com> Date: Thu, 10 Dec 2020 17:35:45 +0100 Message-ID: <87v9d9k49q.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 10 2020 at 10:45, Tvrtko Ursulin wrote: > On 10/12/2020 07:53, Joonas Lahtinen wrote: >> I think later in the thread there was a suggestion to replace this with >> simple counter increment in IRQ handler. > > It was indeed unsafe until recent b00bccb3f0bb ("drm/i915/pmu: Handle > PCI unbind") but now should be fine. > > If kstat_irqs does not get exported it is easy enough for i915 to keep a > local counter. Reasoning was very infrequent per cpu summation is much > cheaper than very frequent atomic add. Up to thousands of interrupts per > second vs "once per second" PMU read kind of thing. Why do you need a atomic_add? It's ONE interrupt which can only be executed on ONE CPU at a time. Interrupt handlers are non-reentrant. The core code function will just return an accumulated counter nowadays which is only 32bit wide, which is what the interface provided forever. That needs to be fixed first. Aside of that the accounting is wrong when the interrupt line is shared because the core accounts interrupt per line not per device sharing the line. Don't know whether you care or not. I'll send out a series addressing irq_to_desc() (ab)use all over the place shortly. i915 is in there... Thanks, tglx