Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp112140lqf; Tue, 26 Mar 2024 16:37:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmlhu8sS0F2djGdCVPC45gtMomcHFxJtL1kiPhRtcYBnJF46mMCKLLU8hCZ/pXBvZ4pao1r2zCyZRevgS+j7GEs8xHZVR0YmjmuNEmlw== X-Google-Smtp-Source: AGHT+IG8KbwfSJkBYRXYs3zNmg+E1hiHWen/N4N95yukaggWbczCguuWCA/HTBHGVtuox4hEuq5M X-Received: by 2002:a2e:8eda:0:b0:2d2:df0d:9e92 with SMTP id e26-20020a2e8eda000000b002d2df0d9e92mr7612196ljl.49.1711496227775; Tue, 26 Mar 2024 16:37:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711496227; cv=pass; d=google.com; s=arc-20160816; b=HNPZoFdSFdHJ+xNIkV8iPoc5uQXEExV8aGAE30JD9pOohRftGCV+bqqIRFEgkDd/Vy 017XQsxcQ/KhrzOYlqTs0NMT7SYVHnHv264w77YkHOodcGdnLsYsuWSABKrilZb1gbNM 1Pe/ZOVD3zTsz7UA/9R960QEVjLjTSRehXoTN/plXjcYnIs0Ebdi4cTA+a41ErWlVhmK b09gisgEu1ThqpX2Pll6GKdsiHKA4MUGSvfE1j7Q1R7Z4cUCyQYQTvEkp9UAEuXmix0F Z7WDqIXp3OdvH/q3UED/smqxHued6Jwgli5A43qYCUs8znUnaqCrQITHZ0+qPZSleuw5 Ma/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding: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=qVoO2SchxdEz7fwpw07CFpmgAKOUXncfAlsQ/m8G3/w=; fh=o3NLvLkur01zqSupISITQb/WgooCr+x3v5Y/PhAGU0U=; b=wNRMjA5kVkPcg/NkX0hCkVbQzBRB11Le87Q9MKua88a6C8eAG6BOI5EvgHB9DN72uP 2N3YSdQ9qxEoXFnygSaoc7hgaWzBxFmUdO4EJT4cq3Af+8wTejRElkuchdzERqjNMEs7 RH63xUKpIpS4W8KCp5ePaJE4U9Q46e9B6Yg+RD9e9mSRCtyP+uhCrS3T/bYnJIMfafMj jAOUtb5lu8QcyXPDSI6OpaOecbZyDmOYUi1KDpp0HHTCohc9y+DF5diOeHIfyvXG4PCg eIGmOMp12CY+H4+F/eHzvMXkhcilFW7/7rtpY44SWeT6iqICoogBai4O3uWK2kfM6gWC P27w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=SnCHX0g1; 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-120140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120140-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 y9-20020a056402440900b0056c28889318si1248009eda.361.2024.03.26.16.37.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 16:37:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120140-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=SnCHX0g1; 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-120140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120140-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 83ABE1F217A9 for ; Tue, 26 Mar 2024 23:37:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08BD313E046; Tue, 26 Mar 2024 23:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SnCHX0g1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="od8qGGCE" 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 A8C1E13E03F for ; Tue, 26 Mar 2024 23:36:59 +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=1711496221; cv=none; b=e/1Lj/R8hvKBftb93ubgR61af9Nm1W1aChxPjTt2JF38DUfm1plWd1wWGLni2Bq9qisCQz/iniOLoAP2m3mkK75Qv1NDq/ivyTidgCw3FEH1+QZGCluN9r7N1U7K5amESovsPl/zTj6z00VvMe8hHXVRDk6IxnA/C+IQuVvey0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711496221; c=relaxed/simple; bh=oahTA6dTYSWMdCkR8OHLK2ha2hSU4kUfoocggeRJGJs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=kNCiA7kYMbkImteBm635gPnlNafQmRR44DobdI/MMcuOBkNEc8ctUtz/LaeApnDgnYGAZ9M4SwgdrvLJ8xWj6MC6SmMm2GraHT9cHAltQCu1MToJfkxj73UQTv0DMG21o/ezAthlwR9IdwoxoW9KhomxDas5UUTevluuwfpf7hM= 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=SnCHX0g1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=od8qGGCE; 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=1711496217; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qVoO2SchxdEz7fwpw07CFpmgAKOUXncfAlsQ/m8G3/w=; b=SnCHX0g1f6/dQ9Gm+zOYX3OywxBLcwYq+1b2na9SUxhs1MmdsK0HskY4tzlfR2eC5LerOa WF6HiGD9OVCvlaKGz4dJFycGpAOzU3rEpjhqtJzZbb2PgkV9FrS3hiBWDYIEA5o1QDy+7t 8SXo9lcEZhnuEudzc4IbEgGUoN4WPzYysXK/JKPPI01dDGUSs0PLmnUXsqwcDZ0grsTCSq TkTkA5TOwPVY9j0ncY1Lpog+6CnuEhojESsqVJUSAR/V4+W9dwx8ObOEhVmCGguCBwKLif N5BLSKieSjCTYaY1nKhrcOGRpE5Y0HlE5elOUPv3QCGvYS7vluT3utLrLowE1Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711496217; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qVoO2SchxdEz7fwpw07CFpmgAKOUXncfAlsQ/m8G3/w=; b=od8qGGCE60/d4xA8vQjxF6rPawNJBjmpfMH52NvmH8q+kcTQc8xaXQ9HTSQsffCwkIqZVh 3QoMyVAQBHaOe4Cg== To: Huang Adrian Cc: linux-kernel@vger.kernel.org, Jiwei Sun , Adrian Huang Subject: Re: [PATCH 1/1] genirq/proc: Try to jump over the unallocated irq hole whenever possible In-Reply-To: References: <20240325035102.15245-1-adrianhuang0701@gmail.com> <874jcueydh.ffs@tglx> Date: Wed, 27 Mar 2024 00:36:57 +0100 Message-ID: <87h6gsefae.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; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 26 2024 at 21:35, Huang Adrian wrote: > On Tue, Mar 26, 2024 at 6:32=E2=80=AFAM Thomas Gleixner wrote: > The reason I made the changes in show_interrupts() is to minimize the > traversal times of the 'sparse_irqs' maple tree since irq_to_desc() is > invoked in show_interrupts(). They are not really relevant. The cache line is hot after the irq_get_next_irq() lookup and maple tree is a highly optimized data structure. I'm not saying that it is free, but if you want to avoid that in the first place then you need to do a lookup of the next descriptor and hand it into show_interrupts() right away and not just hack some completely obscure optimization into show_interrupts(). > @@ -19,6 +19,10 @@ static void *int_seq_next(struct seq_file *f, void > *v, loff_t *pos) [ 3 more citation lines. Click/Enter to show. ] > (*pos)++; > if (*pos > nr_irqs) > return NULL; > + > + if (!irq_to_desc(*pos)) > + *pos =3D irq_get_next_irq(*pos); How is irq_get_next_irq() valid without either holding the sparse irq lock or RCU read lock? Testing this with full debug enabled might give you the answer to that question. But that aside you are missing a massive performance problem in the generic show_interrupts() code: if (desc->kstat_irqs) { for_each_online_cpu(j) any_count |=3D data_race(*per_cpu_ptr(desc->kstat_irqs, j)); } if ((!desc->action || irq_desc_is_chained(desc)) && !any_count) goto outsparse; There are two obvious problems with that, no? Thanks, tglx