Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp303315lqr; Wed, 5 Jun 2024 06:42:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNIv9X5R5lcdpCpDx+3HLu9YaFuxC2+oEVD5UiYebncAh51RWWMZ9b3ASCwYvZcDqq/XXrJz4ioLocQ64i68NLN7J11rzf6tG/s0o+Tg== X-Google-Smtp-Source: AGHT+IE3FN4i+CHE8oEqrrWTaJ5P3M3dNe6Ranctz2m0O1BFUxaf8iukMFZDRjLY6CM9/H0TOrdV X-Received: by 2002:a05:620a:2011:b0:795:228d:32a5 with SMTP id af79cd13be357-79523d3a8cbmr257437785a.17.1717594922377; Wed, 05 Jun 2024 06:42:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717594922; cv=pass; d=google.com; s=arc-20160816; b=hSETqUarytPVK8mKkjhQUqjbXP7DNyR9atQQ7v78PCkKe6Z6V7owAynU2FuAfqTBiJ uGUJgPxmP350/QgZNn8PIfawIQmkNDATVz/5r59f+tMaOJIaU7S4zZ6kjo79mnNSsHKg RB9n6WMJCMVjSWOwaYP4BACvqGPywG9apKkXZKYqPm8pDpL86Drg1EAI98L/cK71f9Ds gp0f4zbAeJFKa8R4OBwwgLvdk0OY99+7aaMU81X053xfDUf9bBLo1ArLVFQPzXrhQUiG VT5kQyfFgHGrcIiHl85GaVPJUjUx2HdJe0+xOzpiP4z1jEEIXj686Pa26tV70vVtrBR4 rCfw== 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=PYWn3g2LyW/uf5CwlkYzfpP0ISOJjU2c39/1Gv+YQ1g=; fh=IJ86CY/BPTsVXKxqnIM0W+stvuJZoFfRV5WrwD93wlI=; b=mSWbRAWXhyGe7tmKZ/dDXEHg6dNU6Yj8ZCpQRqPWqjinxTLzbcnmd+RnYi9rJq8nVs XMdL+Bcpd0lyJJkyn0SBQKkX1Gs+WeuDZlKntJ4OY2/EIqJeuYaVGfVROR0/jbTzGMyd NXpmEyY+ouNptUr56wJOpurt3XvFVAXhyObYME6q6YMpcCOgOAgqTLsayqgoAb3FCOLI qj8QB+yavGzDn2IUF7AZcuLUpRJbiNfzC/SguA74bSoVMBDsUpOd0NTHJuFVJjj2Ujia zHxS4BK6dMBvTgPhQvvI+8G5hmj/9kT8YY2wcVtFaSoj8k/7vFnKwzNXfO6z9Wtm+KEM gELg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ddp9v8gK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-202695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202695-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79501d24904si512201685a.25.2024.06.05.06.42.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 06:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Ddp9v8gK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-202695-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202695-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1094B1C22FBD for ; Wed, 5 Jun 2024 13:42:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 155761957F3; Wed, 5 Jun 2024 13:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ddp9v8gK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cH5GaQgQ" 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 8894A81F; Wed, 5 Jun 2024 13:20:21 +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=1717593623; cv=none; b=BK+EONIBME7vLuDzlG+1OHMTr4iYgw2S/ueMjeKw5hhQn/FkMNZ3EKwdFK5gwgGnIxXimh3r6+o5Coq32mY8UQg4KZ3q6/yg20t4IGfC/VBSFQQm6hCYuK2Y+tRSW+93PmfVCgnCU32hrS5cWLoXIVPBLgOtG19yBbwneEhGAfc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717593623; c=relaxed/simple; bh=PvIoMHkKO8iSZkAT3rpcBtApwteKDRqqo/Ed2wXqyzA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=RnbQerHwWy+nS11w+C0mORIVLzistJTBsKub+LO47YuV2dzi6NFMVoiq8I65Iri3OVeCUHhEZjr1k3Q+281ysLRcJOwYEJ+DA+9Ou/JwAsJw5aHD1jTZhFKKDv6m2sZh394HSLo+t0M8jqUmayYNKegsRSyuU1+Zhkua5MUIZ0k= 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=Ddp9v8gK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cH5GaQgQ; 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=1717593617; 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=PYWn3g2LyW/uf5CwlkYzfpP0ISOJjU2c39/1Gv+YQ1g=; b=Ddp9v8gKf7TG/yoHMTlRJdCgCbMuZDAoJdr03reGWGhqRvm2ms9ZIbXOhIRetGdvQAuHit Rpu6WBl6bp7ywb+O9BHzEMOiD1prm3K3VJo4a33qcoseK3C/2wG1yBXXwrYQa0qr9RmCF/ edsncOPwwbAvi7DDICztg74fpmYSx2TRKcf5LN/yHxomd6vfiSbDhTqQ/naDcZaEL/isml 6+MAKpoATb3XOv9hXqflWq2CkCB4pzHHBZTMP1VQm6qEK2gsIDRYQStZnP6ob8V3m7hwhm q8RXsbyzTLdssZw867eNDgVRsrI25lDKXCQ3SFwkI/JkuycQLAMJ8gzBsNhkdg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717593617; 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=PYWn3g2LyW/uf5CwlkYzfpP0ISOJjU2c39/1Gv+YQ1g=; b=cH5GaQgQzNNMR/vz7Wvmo5cCMV1KcMVlvq8kiT1Lz51056P7AQt8WbRpgSxzTLxowrAd20 voHgBneHNJZdgKCA== To: Michael Kelley , "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: References: <20240604050940.859909-1-mhklinux@outlook.com> <20240604050940.859909-7-mhklinux@outlook.com> <87h6e860f8.ffs@tglx> Date: Wed, 05 Jun 2024 15:20:17 +0200 Message-ID: <87zfrz4jce.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 On Tue, Jun 04 2024 at 23:03, Michael Kelley wrote: > From: Thomas Gleixner Sent: Tuesday, June 4, 2024 11:14 AM >> 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. > > The "inner workings" aren't quite the same in the two cases. > handle_percpu_irq() uses handle_irq_event_percpu() while > handle_percpu_demux_irq() uses __handle_irq_event_percpu(). > The latter doesn't do add_interrupt_randomness() because the > demultiplexed IRQ handler will do it. Doing add_interrupt_randomness() > twice doesn't break anything, but it's more overhead in the hard irq > path, which I'm trying to avoid. The extra functionality in the > non-double-underscore version could be hoisted up to > handle_percpu_irq(), but that offsets gains from sharing the > inner workings. That's not rocket science to solve: static irqreturn_t helper(desc, func) { boiler_plate.. ret = func(desc) boiler_plate.. return ret; } No? TBH, I still hate that conditional accounting :) >> 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. > > Yes, this would work on x86, as the top-level interrupt isn't a Linux IRQ, > and the interrupt counting is done in Hyper-V specific code that could be > removed. The demux'ed interrupt does the counting. > > But on arm64 the top-level interrupt *is* a Linux IRQ, so each > interrupt will get double-counted, which is a problem. What is the problem? You have: toplevel, mgmt, device[], right? They are all accounted for seperately and each toplevel interrupt might result in demultiplexing one or more interrupts (mgmt, device[]), no? IMO accounting the toplevel interrupt seperately is informative because it allows you to figure out whether demultiplexing is clustered or not, but I lost that argument long ago. That's why most demultiplex muck installs a chained handler, which is a design fail on it's own. Thanks, tglx