public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, andrew@lunn.ch,
	vivien.didelot@gmail.com, f.fainelli@gmail.com
Subject: Re: [patch net-next RFC] net: dsa: move port_setup/teardown to be called outside devlink port registered area
Date: Tue, 26 Jul 2022 16:43:09 +0300	[thread overview]
Message-ID: <20220726134309.qiloewsgtkojf6yq@skbuf> (raw)
In-Reply-To: <20220726124105.495652-1-jiri@resnulli.us>

Hi Jiri,

On Tue, Jul 26, 2022 at 02:41:05PM +0200, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Move port_setup() op to be called before devlink_port_register() and
> port_teardown() after devlink_port_unregister().
> 
> RFC note: I don't see why this would not work, but I have no way to
> test this does not break things. But I think it makes sense to move this
> alongside the rest of the devlink port code, the reinit() function
> also gets much nicer, as clearly the fact that
> port_setup()->devlink_port_region_create() was called in dsa_port_setup
> did not fit the flow.
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---

devlink_port->devlink isn't set (it's set in devl_port_register), so
when devlink_port_region_create() calls devl_lock(devlink), it blasts
right through that NULL pointer:

[    4.966960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000320
[    5.009201] [0000000000000320] user address but active_mm is swapper
[    5.015616] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    5.024244] CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.19.0-rc7-07010-ga9b9500ffaac-dirty #3395
[    5.033281] Hardware name: CZ.NIC Turris Mox Board (DT)
[    5.038499] Workqueue: events_unbound deferred_probe_work_func
[    5.044342] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    5.051297] pc : __mutex_lock+0x5c/0x460
[    5.055220] lr : __mutex_lock+0x50/0x460
[    5.133818] Call trace:
[    5.136258]  __mutex_lock+0x5c/0x460
[    5.139831]  mutex_lock_nested+0x40/0x50
[    5.143750]  devlink_port_region_create+0x54/0x15c
[    5.148542]  dsa_devlink_port_region_create+0x64/0x90
[    5.153592]  mv88e6xxx_setup_devlink_regions_port+0x30/0x60
[    5.159165]  mv88e6xxx_port_setup+0x10/0x20
[    5.163345]  dsa_port_devlink_setup+0x60/0x150
[    5.167786]  dsa_register_switch+0x938/0x119c
[    5.172138]  mv88e6xxx_probe+0x714/0x770
[    5.176058]  mdio_probe+0x34/0x70
[    5.179370]  really_probe.part.0+0x9c/0x2ac
[    5.183550]  __driver_probe_device+0x98/0x144
[    5.187902]  driver_probe_device+0xac/0x14c

  reply	other threads:[~2022-07-26 13:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 12:41 [patch net-next RFC] net: dsa: move port_setup/teardown to be called outside devlink port registered area Jiri Pirko
2022-07-26 13:43 ` Vladimir Oltean [this message]
2022-07-26 14:45   ` Jiri Pirko
2022-07-26 15:20     ` Vladimir Oltean
2022-07-26 15:57       ` Jiri Pirko
2022-07-26 16:13         ` Jiri Pirko
2022-07-26 16:55           ` Vladimir Oltean
2022-07-26 18:27             ` Jiri Pirko

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=20220726134309.qiloewsgtkojf6yq@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    /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