Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp189599pxf; Tue, 6 Apr 2021 19:05:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV9pOkkDCX/cy+6+1vKZL5OPVd2Wb+UyvjfQNvF0yvjzajpjYUDVFew2hIUNFElan6lxxL X-Received: by 2002:a17:906:a3c5:: with SMTP id ca5mr1076720ejb.160.1617761144901; Tue, 06 Apr 2021 19:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617761144; cv=none; d=google.com; s=arc-20160816; b=yaWxSN3stL4EQ3yrXOUE/QQNkFQ/puhdBbuFssEhGAdX5u5K2c7Zl46lghrbEV88zV EcH5QWLkqO54CVzKXCQx7NSc5HIoSZgFoQ2+fskf9jFnCKhO5gqF1igUEccnGNmgEaCe o9tnC54fQEGjYhvA3AhEUu1swcqwdbvymaOEwpaMPjnKG7+jzcCOaV+ATul9yCWWGRZL g45suJpPTdY2rhbwVk6xgV5+FJHXbhg71vn3P84YCbZaPOx1588RqL80x7C/uPLhyt2F Kdf5HQXuSAu13iHrsN2PpbQuUWt7PUsPHOcrMgSEKpIRB/MwNgchsQW/GrpD77mvebwm ZwRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=pVYbgpuFHdrugGTNWF+0RmKYvExqMPGcZjTBSDGjAHs=; b=fxp5KtQBmiEphgGJbhB1cy4vbLrx7j9FjOY0KU2QGmZWM8zi50DBuVGUAlUbRmVxly bNxojN4/2k/dF4jUBQwwNDZ4q+RK2zvLcXF7k3sFmezyYlSeUcnIVkgUzwrzlLA+khJJ RKdZgtA7fEbwvwVPrWmyGwmeqLw1lwGjfHPc3iMaVZb01k6MO0wYotLN+zk5M4musvsd pPsDPvwZkD6NOT8HUa/NgXJhLITTJY+dxtPuKYpeuACXLYjPhEoyi6OsyGl5ACNzjpkb qd8n1o08g5xu8D/P2xtAIK0p13sO0vBu7vN9j3uHLLdQ0lxREW/r1T846bTXEgpTD2NG RORg== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn18si17856684ejc.590.2021.04.06.19.05.21; Tue, 06 Apr 2021 19:05:44 -0700 (PDT) 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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238034AbhDFMNG convert rfc822-to-8bit (ORCPT + 99 others); Tue, 6 Apr 2021 08:13:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:38052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235680AbhDFMNF (ORCPT ); Tue, 6 Apr 2021 08:13:05 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BC03613C2; Tue, 6 Apr 2021 12:12:58 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lTkZk-005qpW-3r; Tue, 06 Apr 2021 13:12:56 +0100 Date: Tue, 06 Apr 2021 13:12:55 +0100 Message-ID: <87lf9vpq60.wl-maz@kernel.org> From: Marc Zyngier To: Christophe Leroy Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, Thomas Bogendoerfer , Yoshinori Sato , Haojian Zhuang , Rich Felker , Thomas Gleixner , Robert Jarzmik , Daniel Mack Subject: Re: [PATCH 1/9] irqdomain: Reimplement irq_linear_revmap() with irq_find_mapping() In-Reply-To: <15be426f-4429-ebeb-1b4a-8342bce391e5@csgroup.eu> References: <20210406093557.1073423-1-maz@kernel.org> <20210406093557.1073423-2-maz@kernel.org> <15be426f-4429-ebeb-1b4a-8342bce391e5@csgroup.eu> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: christophe.leroy@csgroup.eu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, tsbogend@alpha.franken.de, ysato@users.sourceforge.jp, haojian.zhuang@gmail.com, dalias@libc.org, tglx@linutronix.de, robert.jarzmik@free.fr, daniel@zonque.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe, On Tue, 06 Apr 2021 12:21:33 +0100, Christophe Leroy wrote: > > > > Le 06/04/2021 à 11:35, Marc Zyngier a écrit : > > irq_linear_revmap() is supposed to be a fast path for domain > > lookups, but it only exposes low-level details of the irqdomain > > implementation, details which are better kept private. > > Can you elaborate with more details ? Things like directly picking into the revmap are positively awful, and doesn't work if the domain has been constructed using the radix tree. Which on its own is totally broken, because things like irq_domain_create_hierarchy() will pick an implementation or the other. > > > > > The *overhead* between the two is only a function call and > > a couple of tests, so it is likely that noone can show any > > meaningful difference compared to the cost of taking an > > interrupt. > > Do you have any measurement ? I did measure things on arm64, and couldn't come up with any difference other than noise. > Can you make the "likely" a certitude ? Of course not. You can always come up with an artificial CPU implementation that has a very small exception entry overhead, and a ridiculously slow memory subsystem. Do I care about these? No. If you can come up with realistic platforms that show a regression with this patch, I'm all ears. > > > > > Reimplement irq_linear_revmap() with irq_find_mapping() > > in order to preserve source code compatibility, and > > rename the internal field for a measure. > > This is in complete contradiction with commit https://github.com/torvalds/linux/commit/d3dcb436 > > At that time, irq_linear_revmap() was less complex than what > irq_find_mapping() is today, and nevertheless it was considered worth > restoring in as a fast path. What has changed since then ? Over 8 years? Plenty. The use of irqdomains has been generalised, we have domain hierarchies, and if anything, this commit introduces the buggy behaviour I was mentioning above. I also don't see any mention of actual performance in that commit. And if we're worried about a fast path, being able to directly cache the irq_data in the revmap, hence skipping the irq_desc lookup that inevitable follows, is a much more interesting prospect than the "get useless data quick" that irq_linear_revmap() implements. This latter optimisation is what I am after. > Can you also explain the reason for the renaming of "linear_revmap" > into "revmap" ? What is that "measure" ? To catch the potential direct use of the reverse map field. Thanks, M. -- Without deviation from the norm, progress is not possible.