Message ID | 20230116135044.14998-12-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1203316wrn; Mon, 16 Jan 2023 05:55:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWOtKSqZWJctvQbPYnwqV0khAKH69dVlgDFICAQYAlUAB6HUrGH0FvGKT5GuZEygYfSAPW X-Received: by 2002:a17:906:f193:b0:84d:3403:f4f4 with SMTP id gs19-20020a170906f19300b0084d3403f4f4mr28162744ejb.64.1673877345993; Mon, 16 Jan 2023 05:55:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673877345; cv=none; d=google.com; s=arc-20160816; b=byLt9A86O85OvjYFUwsBxNkkubSKEWy74IBq70dJIN00IjcIcq6229Ga54plmzG5Sq x/2fihYKD7ecbibo5MNeCEOCGCHc3NqEaHveOqljcylnEDbbD+tCSbUx6foADDSvSSnd lq0aS8W4u2HjW0nItx/vsGaOW28PdL3nJMeWX415WdXD2uTQTTTckIkOeTvyczqR3NL7 bLsIdbykzCWJIkid2h0Nx+xEkd3dMb2jm+N9TboGwIbpznUp6AEh38nHmO03db7PM4hM p6YaM7RBjM/d+B1vJDM8Ij9SvD6rrp9B/rSUS1VvSNPQP4R7tAn9kWDClL1Vg26z3Wmw eWwg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z/ClsNfBkg2pSEDo7D9Er5UKAfTbNSwg5ZQMlU+k9zw=; b=SQ05b95C5q0nchJk338VCLE6sX5DCT+UGecPBfsTzuyxTEfWetXnqHafWnvdO1LWx8 BBf1yrGUxG4EW2ZEr55YbYmBYdAjnulNCmnEKcF17vq1UNiwNfxg9OIFo0XSZPyMbQHO lgwl/r5D2XGHCCmI/oemVeBaGazms5we5o+lF7kpuWqexOcH5sMVwvVoBy1suRtZFUlh zG9pxaEJq+XFkD0iIOJ69TJlEb+wWk5L5+wvBLvL5MkYiBFLim/E9w9nnDX/pfwInWBT pr9ANlouW6axIeE2smqnEOZEC8zkF36a04UM6TFF88/zAHygis+sdgChlFUNX1KsdLeN L4qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iTchXNWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt2-20020a170907728200b00871dfbabf34si675249ejc.282.2023.01.16.05.55.21; Mon, 16 Jan 2023 05:55:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iTchXNWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229712AbjAPNwH (ORCPT <rfc822;stefanalexe802@gmail.com> + 99 others); Mon, 16 Jan 2023 08:52:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231477AbjAPNuq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Jan 2023 08:50:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF8B21966; Mon, 16 Jan 2023 05:50:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1FC13B80F97; Mon, 16 Jan 2023 13:50:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B838C43329; Mon, 16 Jan 2023 13:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673877041; bh=AK3VCepyLTeOpIFmxwgh5xFJYCJU4/85AqeI5PyR5Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTchXNWY+z/sxVHLzD4M9BdaWIAa7SmM3hr6/+6zJyYYXMI2sIrT+/r0hUfT89Npw LaH72M9fgR+oYmIuQYQuQwisq5c4J9r6sQb9RHYhYz+XZaDa1ZLerMd8v1fGI7tOv0 qx6WvR9CvBoci06yw9LLcxtLas/vfUw40VTU6YJ1pdAtvCGQHgp78iMFaxV/YLB1bb Mq4sDq3xphF15PvtMC6HwRHussdS4e6ZR1WgWMgI+qhvgFPg+l1zljkLT1b9p1TLEB f7/83DUqXVmnFnGpQTOIuWQAKR4vDmnB6ezPxzKbPx0AShuc5s8fM5nP1atvhZ8d/d Z0KqzFzrSbEVw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from <johan+linaro@kernel.org>) id 1pHPt6-0003vD-FM; Mon, 16 Jan 2023 14:51:00 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: Marc Zyngier <maz@kernel.org>, Thomas Gleixner <tglx@linutronix.de> Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org>, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, Hsin-Yi Wang <hsinyi@chromium.org>, Mark-PK Tsai <mark-pk.tsai@mediatek.com> Subject: [PATCH v4 11/19] x86/ioapic: Use irq_domain_create_hierarchy() Date: Mon, 16 Jan 2023 14:50:36 +0100 Message-Id: <20230116135044.14998-12-johan+linaro@kernel.org> X-Mailer: git-send-email 2.38.2 In-Reply-To: <20230116135044.14998-1-johan+linaro@kernel.org> References: <20230116135044.14998-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755187612169717872?= X-GMAIL-MSGID: =?utf-8?q?1755187612169717872?= |
Series |
irqdomain: fix mapping race and clean up locking
|
|
Commit Message
Johan Hovold
Jan. 16, 2023, 1:50 p.m. UTC
Use the irq_domain_create_hierarchy() helper to create the hierarchical domain, which both serves as documentation and avoids poking at irqdomain internals. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Hsin-Yi Wang <hsinyi@chromium.org> Tested-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> --- arch/x86/kernel/apic/io_apic.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Comments
On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote: > > - ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops, > - (void *)(long)ioapic); > - > + ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn, > + cfg->ops, > + (void *)(long)ioapic); The 80 character limit has been lifted quite some time ago. Please use the 100 which are now the norm. Thanks, tglx
On Tue, Jan 17, 2023 at 10:41:36PM +0100, Thomas Gleixner wrote: > On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote: > > > > - ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops, > > - (void *)(long)ioapic); > > - > > + ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn, > > + cfg->ops, > > + (void *)(long)ioapic); > > The 80 character limit has been lifted quite some time ago. Please use > the 100 which are now the norm. Not everyone agrees, including coding-style.rst: The preferred limit on the length of a single line is 80 columns. Statements longer than 80 columns should be broken into sensible chunks, unless exceeding 80 columns significantly increases readability and does not hide information. I go above 80 chars when it improves readability, but it's still a soft limit for many of us. I'll change the above, but not sure trying too hard to fit everything in one line really improves things in cases like: - uv_domain = irq_domain_create_hierarchy(x86_vector_domain, 0, 0, fn, - &uv_domain_ops, NULL); + uv_domain = irq_domain_create_hierarchy(x86_vector_domain, 0, 0, fn, &uv_domain_ops, NULL); Johan
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index a868b76cd3d4..9cc4c8e0c3c4 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -2364,9 +2364,9 @@ static int mp_irqdomain_create(int ioapic) return -ENODEV; } - ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops, - (void *)(long)ioapic); - + ip->irqdomain = irq_domain_create_hierarchy(parent, 0, hwirqs, fn, + cfg->ops, + (void *)(long)ioapic); if (!ip->irqdomain) { /* Release fw handle if it was allocated above */ if (!cfg->dev) @@ -2374,8 +2374,6 @@ static int mp_irqdomain_create(int ioapic) return -ENOMEM; } - ip->irqdomain->parent = parent; - if (cfg->type == IOAPIC_DOMAIN_LEGACY || cfg->type == IOAPIC_DOMAIN_STRICT) ioapic_dynirq_base = max(ioapic_dynirq_base,