CPU loading issue

Marc Murphy marcmltd at marcm.co.uk
Thu Jun 18 00:25:13 PDT 2015


Patch to resolve the regex ^POSITION issue for Huawei modems.

diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index ce1fb6f..b8db7c3 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -101,6 +101,8 @@ struct _MMBroadbandModemHuaweiPrivate {
     GRegex *pdpdeact_regex;
     GRegex *ndisend_regex;
     GRegex *rfswitch_regex;
+    GRegex *position_regex;
+    GRegex *posend_regex;

     FeatureSupport ndisdup_support;
     FeatureSupport rfswitch_support;
@@ -133,7 +135,7 @@ get_at_port_list (MMBroadbandModemHuawei *self)
         out = g_list_append (out, port);

     /* Secondary */
-    port = mm_base_modem_get_port_primary (MM_BASE_MODEM (self));
+    port = mm_base_modem_get_port_secondary (MM_BASE_MODEM (self));
     if (port)
         out = g_list_append (out, port);

@@ -3634,6 +3636,14 @@ set_ignored_unsolicited_events_handlers (MMBroadbandModemHuawei *self)
             port,
             self->priv->rfswitch_regex,
             NULL, NULL, NULL);
+        mm_port_serial_at_add_unsolicited_msg_handler (
+            port,
+            self->priv->position_regex,
+            NULL, NULL, NULL);
+        mm_port_serial_at_add_unsolicited_msg_handler (
+            port,
+            self->priv->posend_regex,
+            NULL, NULL, NULL);
     }

     g_list_free_full (ports, (GDestroyNotify)g_object_unref);
@@ -3745,6 +3755,10 @@ mm_broadband_modem_huawei_init (MMBroadbandModemHuawei *self)
                                              G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
     self->priv->rfswitch_regex = g_regex_new ("\\r\\n\\^RFSWITCH:.+\\r\\n",
                                               G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+    self->priv->position_regex = g_regex_new ("\\r\\n\\^POSITION:.+\\r\\n",
+                                              G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
+    self->priv->posend_regex = g_regex_new ("\\r\\n\\^POSEND:.+\\r\\n",
+                                            G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);

     self->priv->ndisdup_support = FEATURE_SUPPORT_UNKNOWN;
     self->priv->rfswitch_support = FEATURE_SUPPORT_UNKNOWN;
@@ -3780,6 +3794,8 @@ finalize (GObject *object)
     g_regex_unref (self->priv->pdpdeact_regex);
     g_regex_unref (self->priv->ndisend_regex);
     g_regex_unref (self->priv->rfswitch_regex);
+    g_regex_unref (self->priv->position_regex);
+    g_regex_unref (self->priv->posend_regex);

     if (self->priv->syscfg_supported_modes)
         g_array_unref (self->priv->syscfg_supported_modes);




> -----Original Message-----
> From: ModemManager-devel [mailto:modemmanager-devel-
> bounces at lists.freedesktop.org] On Behalf Of David McCullough
> Sent: 12 June 2015 02:39
> To: Marc Murphy
> Cc: 'Dan Williams'; 'modemmanager-devel at lists.freedesktop.org';
> 'Aleksander Morgado'
> Subject: Re: CPU loading issue
> 
> 
> Marc Murphy wrote the following:
> > I am using buildroot 2015.05 using glibc/eglibc Linaro toolchain
> > gcc-linaro-arm-linux-gnueabihf-4.9-2014.05_linux
> > Libqmi 1.12.6
> > MM 1.4.6
> > 3.12 kernel
> >
> > Same issue is also on buildroot 2014.05
> 
> Hmm,  ran over night, still at 4-5% CPU.
> 
> I some some patches I have yet to send to the list in my tree,  but I cannot
> see any of them making a difference.
> 
> I am guessing you are going to have to go down the "debug the problem"
> path and get more info on the problem before you can find the cause.
> 
> Cheers,
> Davidm
> 
> 
> > > -----Original Message-----
> > > From: ModemManager-devel [mailto:modemmanager-devel-
> > > bounces at lists.freedesktop.org] On Behalf Of David McCullough
> > > Sent: 11 June 2015 14:19
> > > To: Marc Murphy
> > > Cc: 'Dan Williams'; 'modemmanager-devel at lists.freedesktop.org';
> > > 'Aleksander Morgado'
> > > Subject: Re: CPU loading issue
> > >
> > >
> > > Marc Murphy wrote the following:
> > > > My system is based on an AM3359 (BBB) running at 1GHz so should be
> > > > able to cope with the GPS stream.
> > > >
> > > > If I use gdbserver and attach to MM, when the loading is getting
> > > > really high I can pause the process and the loading instantly drops.
> > > > If I wait a couple of seconds and resume the loading drops to a
> > > > reasonable
> > > level and then slowly creeps up again.
> > >
> > > Ok,  I have been running all day with the 1s setting,  no change
> > > from my last update.  Sitting at 4-6% and only peaking when we are
> > > doing other things to modem manager.
> > >
> > > I just updated to current master for libqmi and ModemManager just to
> > > be sure,  so far its working the same,  will see if it holds up over
> > > more than
> > > 30 minutes.
> > >
> > > What sort of build env are you using for your system ?
> > >
> > > I am running linux 3.10/uClibc built with gcc version 4.8.3. Latest
> > > modem manager,  latest libqmi,  linux native threads (uClibc), not
> > > sure what else might make a difference here.
> > >
> > > Cheers,
> > > Davidm
> > >
> > >
> > > >
> > > > Is there any timestamp logging that I can enable in a similar way
> > > > to
> > > Gstreamer debug ?
> > > >
> > > > Cheers
> > > > Marc
> > > >
> > > > > -----Original Message-----
> > > > > From: ModemManager-devel [mailto:modemmanager-devel-
> > > > > bounces at lists.freedesktop.org] On Behalf Of David McCullough
> > > > > Sent: 11 June 2015 02:45
> > > > > To: Aleksander Morgado
> > > > > Cc: Dan Williams; modemmanager-devel at lists.freedesktop.org; Marc
> > > > > Murphy
> > > > > Subject: Re: CPU loading issue
> > > > >
> > > > >
> > > > > Aleksander Morgado wrote the following:
> > > > > > On Wed, Jun 10, 2015 at 4:30 PM, David McCullough
> > > > > > <david.mccullough at accelecon.com> wrote:
> > > > > > >> > I am using an embedded platform and after a bit of
> > > > > > >> > fiddling I have built
> > > > > the package and used it.
> > > > > > >> >
> > > > > > >> > Trace attached.
> > > > > > >>
> > > > > > >> Thanks; that gets us further since the two functions that
> > > > > > >> are getting called all the time are "match" and "pcre_exec".
> > > > > > >> Unfortunately that doesn't tell us *which* regex this is...
> > > > > > >> Aleksander,
> > > > > any ideas?
> > > > > > >
> > > > > > > Remember Marc has modded the GPS to send data every second.
> > > > > Maybe
> > > > > > > the Huawei is sending more info per second than other modesm
> > > > > > > are
> > > > > sending ?
> > > > > > >
> > > > > > > IIRC the GPS (NMEA?) dumps comes in on 2 of the USB tty
> > > > > > > ports, both of which MM is watching.  The incoming data is
> > > > > > > parsed using the modem manager pattern matching,  thus the
> > > > > > > match/pcre stuff
> > > you see.
> > > > > > >
> > > > > > > The GPS data can be fairly verbose from memory,  depending
> > > > > > > on numbers of satelites etc,  maybe we are just getting too much
> ?
> > > > > > > I am not and expert on the GPS data so I really can't say.
> > > > > > > Perhaps the combination of all modem chitchat is just
> > > > > > > queuing up and modem
> > > > > manager is getting behind ?
> > > > > > >
> > > > > > > I have a 400MHz ARM that I have been running the MU609 in
> > > > > > > for the last
> > > > > day.
> > > > > > > It polls at the default 30 seconds and is still running at
> > > > > > > 0% popping up to 5-6% every now and then.
> > > > > >
> > > > > > Could you maybe set the same 1s update in the MU609 and see if
> > > > > > MM behaves worse in the same board?
> > > > >
> > > > > Running now,  no signs yet.
> > > > >
> > > > > CPU is higher, always 4-6%, will see how it goes over time.
> > > > >
> > > > > Cheers,
> > > > > Davidm
> > > > >
> > > > > --
> > > > > David McCullough,  david.mccullough at accelecon.com,   Ph: 0410 560
> 763
> > > > > _______________________________________________
> > > > > ModemManager-devel mailing list
> > > > > ModemManager-devel at lists.freedesktop.org
> > > > > http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
> > >
> > > --
> > > David McCullough,  david.mccullough at accelecon.com,   Ph: 0410 560 763
> > > _______________________________________________
> > > ModemManager-devel mailing list
> > > ModemManager-devel at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
> 
> --
> David McCullough,  david.mccullough at accelecon.com,   Ph: 0410 560 763
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


More information about the ModemManager-devel mailing list