Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1020602rdb; Wed, 24 Jan 2024 02:18:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEulRNZVvQ8Tn2GfD2toBF5CcxDUqYFVzLKOgv59zI2y0umOA46ohMW8ZFA8+3UxOBN0d6/ X-Received: by 2002:a17:902:f544:b0:1d7:51cf:c77d with SMTP id h4-20020a170902f54400b001d751cfc77dmr425753plf.107.1706091496307; Wed, 24 Jan 2024 02:18:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706091496; cv=pass; d=google.com; s=arc-20160816; b=PjP5iZifxB+jwJX64fTIBDEby43ew0CvJ98MyFLmI32vAw2LMcubWtK6RXwXN3M/RT 8Vw/vOYWwJipt/REr5ZpcJmqHQ/MatWt8TcedGK9y/xpSxTOk16zxW+ZddcElPshPk3X xWkUC51542laB0qo70FhqQZphDpEfTkRMA2jA46Vyc4OGT4qOzuKXWevO8OlyIOSZ4Qy CSdAU9ZKSnEDH2x/Y81xnwudLSQBaOPEAwknU1Z79VeaxeRXqXmtMFxtov/mNfUrRPN4 3HZQN1fmQbQNSudo6N37FDyjrtIOAS7VzMyl5Ihr0us6seYgBkN6TFK0V2iJry5QgbLF vJzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=H3e/bcJ7oTogEXdWq4Lt8Wyvwh7ver2Yak3x4ET5Xzw=; fh=XrL+xRrysAzvFLZUnib9DMK7sMDkzxhf0qweHrvaIk0=; b=lgE4QSC17g3U1xCZWw0litwZj/vQk0+6SX4NN9dyvqyBZLBGn6xEQTAdrlqhxmQBX2 Rkj2uage/OhRQLqrPZWA9gT9CgTAEBrcLxj6Ab5FCISqpwOJrTFYjcFSVUu2A+XltHoB jkuNeuB9GM+I9SZm0+FxtVZjuRUXxvByyDs3LGF3G5Umwwc4rwef0R+43Be+dx0duMrk Ut9aaqwEEP+Ufzf/hJ/J1Mkbzzlmz1tHWGfJzp3oLFnRujvqNJADOzoschdDPdq+fsf5 rxXV7CspCJ6SvqodHGHar61tg6ir2/Yiypaxb/jh9ah3pLC44/QoCHS/gy2anoxQULt8 7uRQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hNcizLo4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y5-20020a170902864500b001d70ad49fa0si10628832plt.356.2024.01.24.02.18.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 02:18:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hNcizLo4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36745-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36745-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4F50EB2929C for ; Wed, 24 Jan 2024 09:51:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E22F1862E; Wed, 24 Jan 2024 09:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hNcizLo4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C4D7218622; Wed, 24 Jan 2024 09:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706089896; cv=none; b=mDpdZ3ek5QdQMelxrSVgxFNQsctJhmoDftPx/CUMDVwgaeyhpsZlCb9QfmjD03aicKHv8yIrhFQqo0bB5q3FByJ6SnCiIYSCA8Be+It/Zsp1s6+yRc1Lx96inwcdmYqg6iWP7wM/g7KlIT4L7sJdXmxPBZBvvE+yog7xtcFfUkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706089896; c=relaxed/simple; bh=7M8cHvNbWMGRFnzMcdPpfzTmbr50voDcLVGu7wSwkPQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=AqSEo6CqjTLtHslFLWiAqFx1c6+ZSuD6ziavZZ4omXUToIFxX3PM5VQJthjoFnvGgMWZ6yzY1FzZFVMIYGwXDWKKlAmUVUndpaZv6qMBoyTMIGnJUHJbQ6YqqGFYmV0L9Xl6tMLl/uUq0xDsJP2plKJP/U1a0Re9UebTznUPeKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hNcizLo4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5611CC433A6; Wed, 24 Jan 2024 09:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706089896; bh=7M8cHvNbWMGRFnzMcdPpfzTmbr50voDcLVGu7wSwkPQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hNcizLo4FfjSKMfh7TZCZZmCjNiHMawDalvAj6G0J8j98C7bpYilNxGrWZwQFlAVc GiPWZxNCkPKNcpCtmAscVfnO1UuJsmyb9nzhpql0j7IQzHxZn4cn+oCwYWdTPDtMmL g3+Oa1YQeEJUReF6VY8MPUYPEGJOjJ+VCvExrVIQmnixCHJxwgctmGpfOxVyKUwT3f gK/xVJfgZyZWhrBtIUYVghknYuWyZDy3Y/Zf+D0NRZ6RbePyGgdVzXqD2SIWpFgvbk 3/GbpxhrswUuSoQPPRWfl0vF1cnjEn8Yg4iINnDlHDzrLtpjZhEm8H2VeMkJTrQDDI 4NVbfr34g5/Zw== Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55c2cf644f3so3278269a12.1; Wed, 24 Jan 2024 01:51:36 -0800 (PST) X-Gm-Message-State: AOJu0Yyzq9ofMRl1JIQnV8Jbj0wSQhf98Wjq4Sv9duDhYxj+BFK5aj92 RsIQXFCjKAGj6qDwBV0s0WgZyyMGkHtkgVx8rWn++xa+tPLKFifUkdCNdRtfqlrmvxtglqDN1La Sj0EkoER9EhApR/y8KgWc8tnSVJc= X-Received: by 2002:a05:6402:3507:b0:559:6c9e:96fe with SMTP id b7-20020a056402350700b005596c9e96femr1835986edd.37.1706089894679; Wed, 24 Jan 2024 01:51:34 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240118121542.748351-1-maobibo@loongson.cn> <20240118121542.748351-2-maobibo@loongson.cn> In-Reply-To: <20240118121542.748351-2-maobibo@loongson.cn> From: Huacai Chen Date: Wed, 24 Jan 2024 17:51:23 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/3] irqchip/loongson-eiointc: Skip handling if there is no pending irq To: Bibo Mao Cc: Jiaxun Yang , Thomas Gleixner , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Shtylyov , lvjianmin@loongson.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Bibo, On Thu, Jan 18, 2024 at 8:15=E2=80=AFPM Bibo Mao wrot= e: > > There is one simple optimization in the interrupt dispatch function > eiointc_irq_dispatch. There are 256 IRQs supported for eiointc, eiointc > irq handler reads the bitmap and find pending irqs when irq happens. > So there are four times of consecutive iocsr_read64 operations for the > total 256 bits to find all pending irqs. If the pending bitmap is zero, > it means that there is no pending irq for the this irq bitmap range, > we can skip handling to avoid some useless operations such as clearing > hw ISR. > > Signed-off-by: Bibo Mao > --- > drivers/irqchip/irq-loongson-eiointc.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq= -loongson-eiointc.c > index 1623cd779175..6143adb1b73b 100644 > --- a/drivers/irqchip/irq-loongson-eiointc.c > +++ b/drivers/irqchip/irq-loongson-eiointc.c > @@ -198,6 +198,17 @@ static void eiointc_irq_dispatch(struct irq_desc *de= sc) > > for (i =3D 0; i < eiointc_priv[0]->vec_count / VEC_COUNT_PER_REG;= i++) { > pending =3D iocsr_read64(EIOINTC_REG_ISR + (i << 3)); > + > + /* > + * Get pending eiointc irq from bitmap status, there are = 4 times > + * consecutive iocsr_read64 operations for 256 IRQs. > + * > + * Skip handling if pending bitmap is zero This driver is shared by Loongson-2 and Loongson-3 series, for Loongson-2K0500 there is only 128 IRQs, so I suggest only keep the last line "Skip handling if current pending bitmap is zero" is enough. Huacai > + */ > + if (!pending) > + continue; > + > + /* Clear the IRQs */ > iocsr_write64(pending, EIOINTC_REG_ISR + (i << 3)); > while (pending) { > int bit =3D __ffs(pending); > -- > 2.39.3 >