linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Andrew Lunn'" <andrew@lunn.ch>,
	"'Michael Walle'" <michael@walle.cc>,
	"'Andy Shevchenko'" <andy.shevchenko@gmail.com>
Cc: <netdev@vger.kernel.org>, <jarkko.nikula@linux.intel.com>,
	<andriy.shevchenko@linux.intel.com>,
	<mika.westerberg@linux.intel.com>, <jsd@semihalf.com>,
	<Jose.Abreu@synopsys.com>, <hkallweit1@gmail.com>,
	<linux@armlinux.org.uk>, <linux-i2c@vger.kernel.org>,
	<linux-gpio@vger.kernel.org>, <mengyuanlou@net-swift.com>
Subject: RE: [PATCH net-next v8 6/9] net: txgbe: Support GPIO to SFP socket
Date: Tue, 23 May 2023 14:12:49 +0800	[thread overview]
Message-ID: <011c01d98d3d$99e6c6e0$cdb454a0$@trustnetic.com> (raw)
In-Reply-To: <005a01d98c8b$e48d2b60$ada78220$@trustnetic.com>

> > > > If you are getting errors when removing the driver it means you are
> > > > missing some level of undoing what us done in probe. Are you sure
> > > > regmap_del_irq_chip() is being called on unload?
> > >
> > > I used devm_* all when I registered them.
> >
> > Look at the ordering. Is regmap_del_irq_chip() being called too late?
> > I've had problems like this with the mv88e6xxx driver and its
> > interrupt controllers. I ended up not using devm_ so i had full
> > control over the order things got undone. In that case, the external
> > devices was PHYs, with the PHY interrupt being inside the Ethernet
> > switch, which i exposed using a Linux interrupt controller.
> 
> I use no devm_ functions to add regmap irq chip, register gpio regmap,
> and call their del/unregister functions at the position corresponding to
> release. irq_domain_remove() call trace still exist.
> 
> [  104.553182] Call Trace:
> [  104.553184]  <TASK>
> [  104.553185]  irq_domain_remove+0x2b/0xe0
> [  104.553190]  regmap_del_irq_chip.part.0+0x8a/0x160
> [  104.553196]  txgbe_remove_phy+0x57/0x80 [txgbe]
> [  104.553201]  txgbe_remove+0x2a/0x90 [txgbe]
> [  104.553205]  pci_device_remove+0x36/0xa0
> [  104.553208]  device_release_driver_internal+0xaa/0x140
> [  104.553213]  driver_detach+0x44/0x90
> [  104.553215]  bus_remove_driver+0x69/0xf0
> [  104.553217]  pci_unregister_driver+0x29/0xb0
> [  104.553220]  __x64_sys_delete_module+0x145/0x240
> [  104.553223]  ? exit_to_user_mode_prepare+0x3c/0x1a0
> [  104.553226]  do_syscall_64+0x3b/0x90
> [  104.553230]  entry_SYSCALL_64_after_hwframe+0x72/0xdc

I think this problem is caused by a conflict calling of irq_domain_remove()
between the two functions gpiochip_irqchip_remove() and regmap_del_irq_chip().
The front one is called by gpio_regmap_unregister().

I adjusted the order of release functions, regmap_del_irq_chip() first, then
gpio_regmap_unregister(). Log became:

[  383.261168] Call Trace:
[  383.261169]  <TASK>
[  383.261170]  irq_domain_remove+0x2b/0xe0
[  383.261174]  gpiochip_irqchip_remove+0xf0/0x210
[  383.261177]  gpiochip_remove+0x4a/0x110
[  383.261181]  gpio_regmap_unregister+0x12/0x20 [gpio_regmap]
[  383.261186]  txgbe_remove_phy+0x57/0x80 [txgbe]
[  383.261190]  txgbe_remove+0x2a/0x90 [txgbe]

irq_domain_remove() just free the memory of irq_domain, but its pointer address
still exists. So it will be called twice.



  parent reply	other threads:[~2023-05-23  6:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  6:31 [PATCH net-next v8 0/9] TXGBE PHYLINK support Jiawen Wu
2023-05-15  6:31 ` [PATCH net-next v8 1/9] net: txgbe: Add software nodes to support phylink Jiawen Wu
2023-05-15  6:31 ` [PATCH net-next v8 2/9] i2c: designware: Add driver support for Wangxun 10Gb NIC Jiawen Wu
2023-05-15  9:24   ` andy.shevchenko
2023-05-17  8:49     ` Jarkko Nikula
2023-05-17  9:25       ` Jiawen Wu
2023-05-17  9:44         ` Andy Shevchenko
2023-05-19 13:26           ` Jarkko Nikula
2023-05-17  9:40       ` Andy Shevchenko
2023-05-15  6:31 ` [PATCH net-next v8 3/9] net: txgbe: Register fixed rate clock Jiawen Wu
2023-05-15  6:31 ` [PATCH net-next v8 4/9] net: txgbe: Register I2C platform device Jiawen Wu
2023-05-15  9:29   ` andy.shevchenko
2023-05-15  6:31 ` [PATCH net-next v8 5/9] net: txgbe: Add SFP module identify Jiawen Wu
2023-05-15  6:31 ` [PATCH net-next v8 6/9] net: txgbe: Support GPIO to SFP socket Jiawen Wu
2023-05-15  9:42   ` andy.shevchenko
2023-05-16  2:38     ` Jiawen Wu
2023-05-16  7:12       ` Andy Shevchenko
2023-05-16  9:39         ` Paolo Abeni
2023-05-16 10:31           ` Russell King (Oracle)
2023-05-17  2:55         ` Jiawen Wu
2023-05-17 10:26           ` Andy Shevchenko
2023-05-17 15:00           ` Andrew Lunn
2023-05-18 11:49             ` Jiawen Wu
2023-05-18 12:27               ` Andy Shevchenko
2023-05-18 16:02                 ` Michael Walle
2023-05-18 16:07                   ` Andy Shevchenko
2023-05-23  9:55                 ` Jiawen Wu
2023-05-23 11:07                   ` Andy Shevchenko
2023-05-23 11:10                     ` Andy Shevchenko
2023-05-18 12:48               ` Andrew Lunn
2023-05-19  2:25                 ` Jiawen Wu
2023-05-19 13:13                   ` Andrew Lunn
2023-05-22  9:00                     ` Jiawen Wu
2023-05-22  9:06                       ` Jiawen Wu
2023-05-22 10:58                       ` Jiawen Wu
2023-05-22 21:36                         ` 'Andy Shevchenko'
2023-05-23  2:08                           ` Jiawen Wu
2023-05-23  6:12                       ` Jiawen Wu [this message]
2023-05-19  8:24                 ` Jiawen Wu
2023-05-19 13:24                   ` Andrew Lunn
2023-05-15 21:36   ` Andy Shevchenko
2023-05-16  2:05     ` Jiawen Wu
2023-05-17 10:29       ` 'Andy Shevchenko'
2023-05-15  6:31 ` [PATCH net-next v8 7/9] net: pcs: Add 10GBASE-R mode for Synopsys Designware XPCS Jiawen Wu
2023-05-15  6:31 ` [PATCH net-next v8 8/9] net: txgbe: Implement phylink pcs Jiawen Wu
2023-05-16  2:45   ` Lars-Peter Clausen
2023-05-15  6:32 ` [PATCH net-next v8 9/9] net: txgbe: Support phylink MAC layer Jiawen Wu
2023-05-16  9:43   ` Paolo Abeni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='011c01d98d3d$99e6c6e0$cdb454a0$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=andrew@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=michael@walle.cc \
    --cc=mika.westerberg@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).