Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp286459lqb; Tue, 4 Jun 2024 11:14:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/wRKfJH7tN1FI1IJF3+4r7JCTNSNouMndxMs6xKLrjMZSqAUtRdq+qacPX0hIjNDlMp1OtwAV/qWEv3csQXxv+Kz11DMaCukv/f/SOQ== X-Google-Smtp-Source: AGHT+IG8Wcib7K2oZq28YXQF/m/hRM7ZsBX/Pd0zbd5kAfDtEUMsByEHfriDh2XH3zvlFqy9hmmn X-Received: by 2002:a17:906:c10:b0:a62:cf3b:77ad with SMTP id a640c23a62f3a-a69a000e31fmr19760466b.49.1717524857035; Tue, 04 Jun 2024 11:14:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717524857; cv=pass; d=google.com; s=arc-20160816; b=xSpC0oGidsZIq0DNg/qyonsbnSZ6msW+XNsp4akfGWF8ZJbVDFimEEUa2tRde2IgsQ pqsn1bPKKjLlBPVAfsVKNziMK/H61NBy33Qt8OlxW7Cw/aTuWJ4ReUTUqm2l9oErt9F7 bEfOYoOJp3JI2c6JkfJ1aEjenFnket2uHfNFfuzQBo9T+jizgTmdVsQHeB9EaGbD47S8 vFh88Hl+ZJXuh8Y9Plpj9WSwuQWUnLA18gBOkfi2KF/O8rVUrKlPZz3of5xx9Fn/kxca 7yGkRTcIy2y0pZyT7Z91oiHv2d8rUfQbJ0NZiia0fUPQX2pvKQsDyI8w6SgG2L6ti67a xM/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=prqacbQcjn+n2e778DNwJeCBy7KaYouq/VzGoavNVk0=; fh=dSkT9zJYqErO3Uu/lz/5wjKkLNyLjqGwtz/69rebjM8=; b=DvG+jJayPuk0wADF3jy02aVUhiGk9/s1ogByPh1SqXErq70iMoWxY5k3scgT6OCC+S cN8P+3APXXG7rJkH0FAU/kuK7qXqklAatrCG28Q/M1AYfhBeF6CjeceF9e7cmIw/oI0f hHVokO0oxTLqIgcH21Ol+HmPyD/grpCQRrIojUthiMIhHt3d0gLDlVNFZ5PXqwSByZWb o8Born55cDCZDQ2069xWQx/vYIB7dL8Xxl50ap85V/636/BF6Sgc21bSmDMOVEhcBixv eHP8kJ8M4WXRXByn2X8uu2CIaWz+/L5gawrL4RSNZIEPy3hMIqAuIZNTJi9ISLSvfnGL FhwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yWklZzVM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=i5UbluQk; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-201233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a68c98a33a0si345569766b.192.2024.06.04.11.14.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 11:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yWklZzVM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=i5UbluQk; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-201233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id BBFF51F2251F for ; Tue, 4 Jun 2024 18:14:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBC6214A4F1; Tue, 4 Jun 2024 18:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yWklZzVM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="i5UbluQk" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F2391474A5; Tue, 4 Jun 2024 18:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717524847; cv=none; b=lwYbRqa+f2k9epQc0hVvR9XveBpCwaPKj/xAAFxu8LjgBmRdLtcA5iZ0hu2kZLInp314KKDjzGUcQh+E2TcXyaY6KrE8XurDz6M22aAUiWCWzwGvKdskStRUNSYiVoKNDhBwONXo997cg5JBTpfDdW64QB/K89zO/2hV6bMxUsI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717524847; c=relaxed/simple; bh=IQorAkEYVe7up2fEOE5YbCTLI6WLK8ATjBO+3so6jGo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=Yc5VsutnOE8VkhiSnqbySgodd4+uZVhuYYZdEotTCxIGUnJXv5NcEhcEOiK+nu6umw9RHbOaBBIYT3CMB6n3qlxKw8n39jtni05EwiYLBTtalhQ592uzCHOaAHvIXJ6okgY68wn7Gu9DWozoUyaHt+ITmhSJpUYzB5het8Nc+Bo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yWklZzVM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=i5UbluQk; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1717524843; 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=prqacbQcjn+n2e778DNwJeCBy7KaYouq/VzGoavNVk0=; b=yWklZzVMpbVPvo1jsg92p8nTHAt1+QsyoNE2Jqvzm/GJhF53kUgNnWEK0/VSjE0lInxBJk 6QlzenLDS2bav5DZMTXwghTPabby9O+Wcn35RIM7N6SXchmN56eQo8ZWJwhBjlIZDjuFH9 C1eQu+zyGFJMIMi31hmA/cNS7thPysEDB59EtjIeQzMz4zvgZtezwUHwX8/SLdOwSXVUHn OtUjg4nSWaY3qhLzt0nT+GEKGWP6cst3YplGGVzD31cO2/vRebBzO6atGsGw6RjAGFdRm0 cDlWXOc+XUPHbzxbl16+md+qkDOExEqrlMk4CaWP/sy+tPRW4/uWvKUdypWiZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717524843; 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=prqacbQcjn+n2e778DNwJeCBy7KaYouq/VzGoavNVk0=; b=i5UbluQk14qgiFhIoUjI4lmomrHRuLLynuD8lVZmZelI6F0yTli9Pi7qVDz6qBXyjFmMV7 DzFuKq0VCpesHjCg== To: mhklinux@outlook.com, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com, arnd@arndb.de, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, linux-arch@vger.kernel.org Cc: maz@kernel.org, den@valinux.co.jp, jgowans@amazon.com, dawei.li@shingroup.cn Subject: Re: [RFC 06/12] genirq: Add per-cpu flow handler with conditional IRQ stats In-Reply-To: <20240604050940.859909-7-mhklinux@outlook.com> References: <20240604050940.859909-1-mhklinux@outlook.com> <20240604050940.859909-7-mhklinux@outlook.com> Date: Tue, 04 Jun 2024 20:13:47 +0200 Message-ID: <87h6e860f8.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Michael! On Mon, Jun 03 2024 at 22:09, mhkelley58@gmail.com wrote: > Hyper-V VMBus devices generate interrupts that are multiplexed > onto a single per-CPU architectural interrupt. The top-level VMBus > driver ISR demultiplexes these interrupts and invokes per-device > handlers. Currently, these per-device handlers are not modeled as > Linux IRQs, so /proc/interrupts shows all VMBus interrupts as accounted > to the top level architectural interrupt. Visibility into per-device > interrupt stats requires accessing VMBus-specific entries in sysfs. > The top-level VMBus driver ISR also handles management-related > interrupts that are not attributable to a particular VMBus device. > > As part of changing VMBus to model VMBus per-device handlers as > normal Linux IRQs, the top-level VMBus driver needs to conditionally > account for interrupts. If it passes the interrupt off to a > device-specific IRQ, the interrupt stats are done by that IRQ > handler, and accounting for the interrupt at the top level > is duplicative. But if it handles a management-related interrupt > itself, then it should account for the interrupt itself. > > Introduce a new flow handler that provides this functionality. > The new handler parallels handle_percpu_irq(), but does stats > only if the ISR returns other than IRQ_NONE. The existing > handle_untracked_irq() can't be used because it doesn't work for > per-cpu IRQs, and it doesn't provide conditional stats. There is a two other options to solve this: 1) Move the inner workings of handle_percpu_irq() out into a static function which returns the 'handled' value and share it between the two handler functions. 2) Allocate a proper interrupt for the management mode and invoke it via generic_handle_irq() just as any other demultiplex interrupt. That spares all the special casing in the core code and just works. Thanks, tglx