From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: * X-Spam-Status: No, score=1.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, PDS_HP_HELO_NORDNS,RDNS_NONE,SPF_HELO_NONE,SPF_NONE,SPOOFED_FREEMAIL_NO_RDNS autolearn=no autolearn_force=no version=3.4.0 Received: from mail-pj1-f67.google.com ([209.85.216.67]:40409 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729852AbgCKQcx (ORCPT ); Wed, 11 Mar 2020 12:32:53 -0400 Date: Wed, 11 Mar 2020 22:02:49 +0530 From: afzal mohammed To: Thomas Bogendoerfer Cc: Nathan Chancellor , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ralf Baechle , Paul Burton , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, "Maciej W. Rozycki" , Jiaxun Yang , Keguang Zhang , Huacai Chen , John Crispin Subject: Re: [PATCH v4] MIPS: Replace setup_irq() by request_irq() Message-ID: <20200311163249.GA4984@afzalpc> References: <20200304203144.GA4323@alpha.franken.de> <20200305115759.3186-1-afzal.mohd.ma@gmail.com> <20200311053126.GA48442@ubuntu-m2-xlarge-x86> <20200311090308.GA5060@afzalpc> <20200311104217.GA10615@alpha.franken.de> <20200311131210.GA5115@afzalpc> <20200311160307.GA15464@alpha.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311160307.GA15464@alpha.franken.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: Hi, On Wed, Mar 11, 2020 at 05:03:07PM +0100, Thomas Bogendoerfer wrote: > On Wed, Mar 11, 2020 at 06:42:10PM +0530, afzal mohammed wrote: > > If IRQF_SHARED is passed, it exepcts a non-NULL dev_id, here it is > > NULL, setup_irq() doesn't have any check like that. > > so request_irq() is not a 1:1 replacement for our current setup_irq(). > Or put it the another way our setup_irq() might be buggy, when used for > shared interrupts. AFAIU, this causes problems only while freeing irq, but not sure. Seems it is not happening with any of the cases in the diff. > > So i think proper solution is to add a non NULL dev_id, as removing > > IRQF_SHARED might affect some platforms that might be using that > > interrupt line shared. > > > > Patch with non-NULL dev_id below, it works w/ Nathan's test case. > > I'm not sure, I like the adding of string pointers as dev_id arguments > in your patch. How can we make sure they are unique enough for the use > case ? I guess using handler as dev_id does a better job here. There was one prior similar usage using string pointers, another way i have seen is using irq no. itself, but then it has to be typecasted, in file arch/mips/txx9/generic/pci.c, request_irq(irq, &i8259_interrupt, IRQF_SHARED, "cascade(i8259)", (void *)(long)irq); [ but i think that double casting is not required, only (void *) might suffice ] If you prefer handler function pointer, i will use that. > And before doing that, lets clean up some of the IRQF_SHARED usage first. > All sni IRQF_SHARED can go away, the interrupt lines are exclusive there. > > loongson2ef/lemote-2f/irq.c: looks like the only user of > LOONGSON_NORTH_BRIDGE_IRQ, so IRQF_SHARED could go as well. > Could someone confirm that ? > > All other need to stay, IMHO. Okay, i am venturing into MIPS the first time as part of this patch series, so no MIPS specific knowledge, just let me know loongson2ef/lemote-2f case as well, i will prepare patch accordingly. > And v4 is already in mips-next, so I need an incremental patch please. Okay, i already sent a patch, it crossed your mail, i will make a new patch based on the outcome of the discusson here. Since there is some issue w/ lore.kernel.org, i send it again, but both are not seen in archives. Regards afzal From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by archive.lwn.net (Postfix) with ESMTPS id 760187D910 for ; Wed, 11 Mar 2020 16:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ri77Cf0Xp7N+WsTzKoarXiykN2rGTiYg5EtABv/FEI4=; b=Ah+WybCQTNLT+C 38Wmt7u6pDNTaxRTpuUO8Wnei+s4iWen+0vzYuyPenBZcJ5SuM7hllIPl+6QFfFh+7Co4DzEPrwiU xxfvXVkOyKd5FyKaI4c6JHKpdUC0/BH4gN94CsiJIqh4+Vc8dpOzn/1K+7Y4pu+tu+XzV4RxSxVhE 8suK2kAwqj3883qignspe6Y8nQLWXyM1r189GJDC5Hmyx8bvfkVsnc0qwrOib0fovuy6pplAtdVms 2QVNbJ1HDZfPBjZiUIOKkRjwy2OFjvM9Oidky4nsxN5JC7w0JTVn7rIDQosEL9/89+mDE5BYVZFPK By5SaRcW5ShkCte5P6Vg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC4Hv-0002zh-Pc; Wed, 11 Mar 2020 16:32:55 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC4Hs-0002zL-Jj for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2020 16:32:54 +0000 Received: by mail-pj1-x1043.google.com with SMTP id l36so1236081pjb.3 for ; Wed, 11 Mar 2020 09:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zmUBvFmNMYqAgE4hUh5PxorZyEbBCYGzea7UV2DPByM=; b=okn3wxoxdRHK59h+9WIq7oUfCZKvj8jYSlljDW2vEtjcLJX7mgYZASlfNT2PSYE6Ew hTxbbboBZjfEQPOaLaDTKkp2kAaVqZVROy0sVYOndeFLtoC7w9dk7d90z8EtJQq0Vx0R vy9cgKIwOxAWv5BdqTYwtuiYYyguWrlCbqRIYcLTabjY59Uz+WnOAb8XXE+r/5G2b4FS 0hKP4XWaegGUW05mM/tuyOjn8lu6DjLqOKDzuzDjE1W3KtsqetyMjI5B1hTR1nJumbKu vF4IfBaBzIIt5RZA++Mg8wN3WcVTwUS5m/euqks2Ta8zJGfFhw2KCVKjQnHaLV+MY2Wg tbuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zmUBvFmNMYqAgE4hUh5PxorZyEbBCYGzea7UV2DPByM=; b=QU9cuLZW9Ts+eFapGsagR6Kovfqp9OkNWChE60LBXWvaoHfsajbD4y0/BaJI0B4uY5 piaFe/051Y+Vg3+vTAjJgNFR8OcKu73xHb1AhIK7TuHjnA5asqyEQoNOcKcCPRv9cq+8 vxj4X4Pj6evkyDPAwaypfjFEYozlmoBBQZijJGiv5n8ejUem126EOTpy+5lDIEOo5Vw3 d0KPROaSyuMZ9bATDihvEwAa5th4jdk5y4huh3w77zG3A7Tm36WdbIZYMheN9iHuVRSI oSAZv0VNSJst8SvKrYCCGGubLqthQ/+p8H7tDyom/NNbmK06cECRR67aEpm/HJJqkrSx dPbQ== X-Gm-Message-State: ANhLgQ3IhcNeJqG1e7G2cY8RmOeqcjSCqn023zZ8DDlPUco52lTRxAca vk2a2OU7d1H8LLXi5RRWmr8= X-Google-Smtp-Source: ADFU+vtseRHn4vAz5dlT4WliTsDFscNXLHw6uylAKsWiiB6pM6JEaG1187JNfqDIKnTVPdUgOiyByg== X-Received: by 2002:a17:90a:4487:: with SMTP id t7mr4170485pjg.104.1583944371770; Wed, 11 Mar 2020 09:32:51 -0700 (PDT) Received: from localhost ([106.51.232.35]) by smtp.gmail.com with ESMTPSA id q12sm51720409pfh.158.2020.03.11.09.32.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Mar 2020 09:32:50 -0700 (PDT) Date: Wed, 11 Mar 2020 22:02:49 +0530 From: afzal mohammed To: Thomas Bogendoerfer Subject: Re: [PATCH v4] MIPS: Replace setup_irq() by request_irq() Message-ID: <20200311163249.GA4984@afzalpc> References: <20200304203144.GA4323@alpha.franken.de> <20200305115759.3186-1-afzal.mohd.ma@gmail.com> <20200311053126.GA48442@ubuntu-m2-xlarge-x86> <20200311090308.GA5060@afzalpc> <20200311104217.GA10615@alpha.franken.de> <20200311131210.GA5115@afzalpc> <20200311160307.GA15464@alpha.franken.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200311160307.GA15464@alpha.franken.de> User-Agent: Mutt/1.9.3 (2018-01-21) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200311_093252_696540_816867D8 X-CRM114-Status: GOOD ( 18.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Paul Burton , linux-mips@vger.kernel.org, Ralf Baechle , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Jiaxun Yang , "Maciej W. Rozycki" , John Crispin , Huacai Chen , Nathan Chancellor , Keguang Zhang , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+lwn-linux-arm-kernel=archive.lwn.net@lists.infradead.org Archived-At: List-Archive: Hi, On Wed, Mar 11, 2020 at 05:03:07PM +0100, Thomas Bogendoerfer wrote: > On Wed, Mar 11, 2020 at 06:42:10PM +0530, afzal mohammed wrote: > > If IRQF_SHARED is passed, it exepcts a non-NULL dev_id, here it is > > NULL, setup_irq() doesn't have any check like that. > > so request_irq() is not a 1:1 replacement for our current setup_irq(). > Or put it the another way our setup_irq() might be buggy, when used for > shared interrupts. AFAIU, this causes problems only while freeing irq, but not sure. Seems it is not happening with any of the cases in the diff. > > So i think proper solution is to add a non NULL dev_id, as removing > > IRQF_SHARED might affect some platforms that might be using that > > interrupt line shared. > > > > Patch with non-NULL dev_id below, it works w/ Nathan's test case. > > I'm not sure, I like the adding of string pointers as dev_id arguments > in your patch. How can we make sure they are unique enough for the use > case ? I guess using handler as dev_id does a better job here. There was one prior similar usage using string pointers, another way i have seen is using irq no. itself, but then it has to be typecasted, in file arch/mips/txx9/generic/pci.c, request_irq(irq, &i8259_interrupt, IRQF_SHARED, "cascade(i8259)", (void *)(long)irq); [ but i think that double casting is not required, only (void *) might suffice ] If you prefer handler function pointer, i will use that. > And before doing that, lets clean up some of the IRQF_SHARED usage first. > All sni IRQF_SHARED can go away, the interrupt lines are exclusive there. > > loongson2ef/lemote-2f/irq.c: looks like the only user of > LOONGSON_NORTH_BRIDGE_IRQ, so IRQF_SHARED could go as well. > Could someone confirm that ? > > All other need to stay, IMHO. Okay, i am venturing into MIPS the first time as part of this patch series, so no MIPS specific knowledge, just let me know loongson2ef/lemote-2f case as well, i will prepare patch accordingly. > And v4 is already in mips-next, so I need an incremental patch please. Okay, i already sent a patch, it crossed your mail, i will make a new patch based on the outcome of the discusson here. Since there is some issue w/ lore.kernel.org, i send it again, but both are not seen in archives. Regards afzal _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel