netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Palmas <dnlplm@gmail.com>
To: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Slark Xiao <slark_xiao@163.com>,
	 Muhammad Nuzaihan <zaihan@unrealasia.net>,
	Johannes Berg <johannes@sipsolutions.net>,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	 "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	 netdev@vger.kernel.org, Qiang Yu <quic_qianyu@quicinc.com>,
	 Manivannan Sadhasivam <mani@kernel.org>,
	Johan Hovold <johan@kernel.org>
Subject: Re: [RFC PATCH v2 0/6] net: wwan: add NMEA port type support
Date: Fri, 10 Oct 2025 15:47:30 +0200	[thread overview]
Message-ID: <CAGRyCJGHv19PJ+hyaTYf40GeGRHMXKi-qO0sgREnS3=7rfWGqA@mail.gmail.com> (raw)
In-Reply-To: <16c0b1fa-9617-4ee1-b82f-e6237d7b5f6f@gmail.com>

Hi Sergey and Loic,

Il giorno mer 8 ott 2025 alle ore 23:00 Sergey Ryazanov
<ryazanov.s.a@gmail.com> ha scritto:
>
> Hi Loic, Daniele,
>
> On 10/2/25 18:44, Loic Poulain wrote:
> > On Tue, Sep 30, 2025 at 9:22 AM Daniele Palmas <dnlplm@gmail.com> wrote:
> > [...]
> >> diff --git a/drivers/net/wwan/wwan_hwsim.c b/drivers/net/wwan/wwan_hwsim.c
> >> index a748b3ea1602..e4b1bbff9af2 100644
> >> --- a/drivers/net/wwan/wwan_hwsim.c
> >> +++ b/drivers/net/wwan/wwan_hwsim.c
> >> @@ -236,7 +236,7 @@ static void wwan_hwsim_nmea_emul_timer(struct timer_list *t)
> >>          /* 43.74754722298909 N 11.25759835922875 E in DMM format */
> >>          static const unsigned int coord[4 * 2] = { 43, 44, 8528, 0,
> >>                                                     11, 15, 4559, 0 };
> >> -       struct wwan_hwsim_port *port = from_timer(port, t, nmea_emul.timer);
> >> +       struct wwan_hwsim_port *port = timer_container_of(port, t,
> >> nmea_emul.timer);
> >>
> >> it's basically working fine in operative mode though there's an issue
> >> at the host shutdown, not able to properly terminate.
> >>
> >> Unfortunately I was not able to gather useful text logs besides the picture at
> >>
> >> https://drive.google.com/file/d/13ObWikuiMMUENl2aZerzxFBg57OB1KNj/view?usp=sharing
> >>
> >> showing an oops with the following call stack:
> >>
> >> __simple_recursive_removal
> >> preempt_count_add
> >> __pfx_remove_one
> >> wwan_remove_port
> >> mhi_wwan_ctrl_remove
> >> mhi_driver_remove
> >> device_remove
> >> device_del
> >>
> >> but the issue is systematic. Any idea?
> >>
> >> At the moment I don't have the time to debug this deeper, I don't even
> >> exclude the chance that it could be somehow related to the modem. I
> >> would like to further look at this, but I'm not sure exactly when I
> >> can....
> >
> > Thanks a lot for testing, Sergey, do you know what is wrong with port removal?
>
> Daniele, thanks a lot for verifying the proposal on a real hardware and
> sharing the build fix.
>
> Unfortunately, I unable to reproduce the crash. I have tried multiple
> times to reboot a VM running the simulator module even with opened GNSS
> device. No luck. It reboots and shutdowns smoothly.
>

I've probably figured out what's happening.

The problem seems that the gnss device is not considered a wwan_child
by is_wwan_child and this makes device_unregister in wwan_remove_dev
to be called twice.

For testing I've overwritten the gnss device class with the following hack:

diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 4d29fb8c16b8..32b3f7c4a402 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -599,6 +599,7 @@ static int wwan_port_register_gnss(struct wwan_port *port)
                gnss_put_device(gdev);
                return err;
        }
+       gdev->dev.class = &wwan_class;

        dev_info(&wwandev->dev, "port %s attached\n", dev_name(&gdev->dev));

and now the system powers off without issues.

So, not sure how to fix it properly, but at least does the analysis
make sense to you?

Thanks,
Daniele

> --
> Sergey

  reply	other threads:[~2025-10-10 14:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 21:37 [RFC PATCH v2 0/6] net: wwan: add NMEA port type support Sergey Ryazanov
2025-06-24 21:37 ` [RFC PATCH v2 1/6] net: wwan: core: remove unused port_id field Sergey Ryazanov
2025-06-24 21:37 ` [RFC PATCH v2 2/6] net: wwan: core: split port creation and registration Sergey Ryazanov
2025-06-24 21:37 ` [RFC PATCH v2 3/6] net: wwan: core: split port unregister and stop Sergey Ryazanov
2025-06-24 21:37 ` [RFC PATCH v2 4/6] net: wwan: add NMEA port support Sergey Ryazanov
2025-06-24 21:38 ` [RFC PATCH v2 5/6] net: wwan: hwsim: refactor to support more port types Sergey Ryazanov
2025-06-24 21:38 ` [RFC PATCH v2 6/6] net: wwan: hwsim: support NMEA port emulation Sergey Ryazanov
2025-06-29  2:50 ` [RFC PATCH v2 0/6] net: wwan: add NMEA port type support Loic Poulain
2025-06-29 10:07   ` Sergey Ryazanov
2025-06-30  7:30     ` Loic Poulain
2025-09-11  2:42       ` Slark Xiao
2025-09-14 16:43         ` Sergey Ryazanov
2025-09-16  7:23           ` Slark Xiao
2025-09-22  8:03             ` Loic Poulain
2025-09-22 20:19               ` Daniele Palmas
2025-09-30  7:10                 ` Daniele Palmas
2025-10-02 15:44                   ` Loic Poulain
2025-10-08 21:01                     ` Sergey Ryazanov
2025-10-10 13:47                       ` Daniele Palmas [this message]
2025-10-12 22:55                         ` Sergey Ryazanov
2025-11-14  7:08                           ` Slark Xiao
2025-11-19 11:27                             ` Loic Poulain
2025-11-24  6:57                               ` Slark Xiao

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='CAGRyCJGHv19PJ+hyaTYf40GeGRHMXKi-qO0sgREnS3=7rfWGqA@mail.gmail.com' \
    --to=dnlplm@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johan@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mani@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_qianyu@quicinc.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=slark_xiao@163.com \
    --cc=zaihan@unrealasia.net \
    /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).