Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp972112pxb; Fri, 22 Apr 2022 15:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyFXxFvQGVfp0pomivZS7cpwCrPLQyv4DsXmYEBBULJoaW2WQj5RSBKonmAH+7wo//MMWQ X-Received: by 2002:a63:8042:0:b0:3aa:e0fb:55c4 with SMTP id j63-20020a638042000000b003aae0fb55c4mr1876358pgd.555.1650667239933; Fri, 22 Apr 2022 15:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650667239; cv=none; d=google.com; s=arc-20160816; b=TrQm/bE4814HOIY3trTpM9FygrHYEFVGsAH4a6DAalF+cOln+mjQbQJdJQv2/cj7b5 3bEhrA9pM0b7YxVBrB23f8TRnHQ3PpTGqS2etVogroDqJ+vmKdWV4kr36ppwlZSnDM54 PHU1Q2OzkXz/Nf03Eg58Vc72YHFCpYtumz9fZnxR3P4fPB3U8/BkpaNspt8xMbVw/yMZ 17YH42Zq8ORhH+D0GN0P1mVmaWr/WThzqz9BLE9E5wnj3EME97M6Qz57t3bMVLnLnS4H rg7vhILsbRKlqf3hsU5KO9PBWvVAcEcgoBedkDYq02UMeXi0+9p5qVZNIcP5fLrdKfu+ Sx1w== 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=CYIjb5ot+DXDq9R/lT/ZSWg8BN/TKlauVlu3GfZ3FtU=; b=Y6BArmKkVzVlvRdT7JeETU0sFwSbROzFeF8S2m0t/of6bVQHy+HGt3omMpNPSBwvkF EoE3nTKqRkraF7O1+UiI5CKFn+14t3Y+3VBNXMuN5N4BhX+7gI57xe+sOqYJ6fzEl+/x zsfIq8tv2+J+VOcj5fDlAegSRyabitdgzfvC4H74By0ktkJSuVnFge5jq6tlpeoVyXQo EBrTYjoclOfxhOOzdTwDB4y8TnfC5Y+kV1toGZQxjBTmZalP6wGKNCeElfgxmNu01YQW scveKneD5TO4ILCydm2BRD48S0yOb+l5+3MtGcEQkt92l/yS3gaW6VBLJq7cr2T3AIJT w9NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JhHDW8jR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q9-20020a17090311c900b00153b2d16598si10869817plh.416.2022.04.22.15.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:40:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JhHDW8jR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2319027BD17; Fri, 22 Apr 2022 13:28:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379334AbiDTOJI (ORCPT + 99 others); Wed, 20 Apr 2022 10:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379344AbiDTOJH (ORCPT ); Wed, 20 Apr 2022 10:09:07 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62325434A8 for ; Wed, 20 Apr 2022 07:06:12 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id bx5so2031424pjb.3 for ; Wed, 20 Apr 2022 07:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CYIjb5ot+DXDq9R/lT/ZSWg8BN/TKlauVlu3GfZ3FtU=; b=JhHDW8jR8pb/E7zcpG1BJ2se2nBWyC7Vs20lwwcBreD3VwgOeCufaHmaRAejXrBW5J Vzd76qLCSqwltDscmS0OgjQRq2pwTtI5B/tKldbPuF8gDOuTQkt2z428uDqjxJQlSLEt SytP5+2cgL4JsQLr4j0d5upl1Z5hZQXVHzMxixlBVp5OtiMRegc5bzGEuyKHjW3FkbHM SCgfXr3qizY4OCvAyZG2kMXzI5TdKyP00exqWkvzfhl2Ho5x7/JmAaN9tHLfZWGzpLZz 7ZSK5m7HyUHxcvzT6fmeIbJYKNhUhkyPGbAEjRH9+vy0oD0OIP381CWcH9vDHav0F5MM azlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CYIjb5ot+DXDq9R/lT/ZSWg8BN/TKlauVlu3GfZ3FtU=; b=EKXxXl8cEg8Zc5mPTgYTqA/T3f0+rL1NgRbI0RKopnm3HYkxOjsfieg9rb58Ki2qrH FuDuxjcTrVBU1SdnYmm1ea+hJvUOUgpcTRATlP0q7aNahXllAN5eVaB+m8YObORohzJY fwLrHCTay+7mauHZXgTElhap/29FKzdYbVMDuho1ObVCtGNcbyPzzfs4GrMjsESWONRG ayV30NtazMk4HITLuyJXNSNkxamK6GBt70FvfS/Pa96sitJ+OGdf0P8BbxFP14WGLaeC wzuMC8SflrcgUB7isEJ/Bw5zu0qDe5x2Me1s2hPcSNWkl/48+qnoQCm4nwSG+Ex2/Qe4 Si2A== X-Gm-Message-State: AOAM531bGLANForhLZrJojjmRSPvwmpXOf5Q7tQoK0ADQCGoPN6NbsOE zPI3RkSKnL65N6HVqAJ17EqcwKQ8HQ== X-Received: by 2002:a17:902:ca04:b0:158:eab9:2676 with SMTP id w4-20020a170902ca0400b00158eab92676mr19594831pld.1.1650463571694; Wed, 20 Apr 2022 07:06:11 -0700 (PDT) Received: from piliu.users.ipa.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id br10-20020a056a00440a00b0050a777cd10csm10959178pfb.91.2022.04.20.07.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 07:06:11 -0700 (PDT) From: Pingfan Liu To: linux-kernel@vger.kernel.org Cc: Pingfan Liu , Thomas Gleixner , Marc Zyngier , Wolfram Sang , Sebastian Andrzej Siewior , Mark Rutland Subject: [PATCH 8/9] irq: make irq_lock_sparse() independent of CONFIG_SPARSE_IRQ Date: Wed, 20 Apr 2022 22:05:20 +0800 Message-Id: <20220420140521.45361-9-kernelfans@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220420140521.45361-1-kernelfans@gmail.com> References: <20220420140521.45361-1-kernelfans@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org Even in the case of non-sparse irq, the callsite of for_each_active_irq() in irq_debugfs_init() still cares about the sync of allocated_irqs bitmap. Otherwise irq_debugfs_init() may show some disappeared irq if the irq is disactived by other driver in parallel. As there are only a few callsites of irq_lock_sparse() in the cold path, which means the slight performance drops can be ignored. Hence moving irq_lock_sparse() out of CONFIG_SPARSE_IRQ to protect both irq_desc and allocated_irqs bitmap, instead of making irq_lock_sparse() dependent on GENERIC_IRQ_DEBUGFS. Signed-off-by: Pingfan Liu Cc: Thomas Gleixner Cc: Marc Zyngier Cc: Wolfram Sang Cc: Sebastian Andrzej Siewior Cc: Mark Rutland To: linux-kernel@vger.kernel.org --- include/linux/irqdesc.h | 6 ++---- kernel/irq/irqdesc.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index a77584593f7d..6c01231fec00 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -104,12 +104,10 @@ struct irq_desc { const char *name; } ____cacheline_internodealigned_in_smp; -#ifdef CONFIG_SPARSE_IRQ extern void irq_lock_sparse(void); extern void irq_unlock_sparse(void); -#else -static inline void irq_lock_sparse(void) { } -static inline void irq_unlock_sparse(void) { } + +#ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS]; #endif diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 9feedaa08430..a5cefd7c9ef7 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -375,16 +375,6 @@ static void free_masks(struct irq_desc *desc) static inline void free_masks(struct irq_desc *desc) { } #endif -void irq_lock_sparse(void) -{ - mutex_lock(&sparse_irq_lock); -} - -void irq_unlock_sparse(void) -{ - mutex_unlock(&sparse_irq_lock); -} - static struct irq_desc *alloc_desc(int irq, int node, unsigned int flags, const struct cpumask *affinity, struct module *owner) @@ -721,6 +711,16 @@ int generic_handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq) } #endif +void irq_lock_sparse(void) +{ + mutex_lock(&sparse_irq_lock); +} + +void irq_unlock_sparse(void) +{ + mutex_unlock(&sparse_irq_lock); +} + /* Dynamic interrupt handling */ /** -- 2.31.1