Readit News logoReadit News
megous · 5 years ago
> While developing software on the PinePhone, I came across this peculiar message in dmesg:

Beautiful seeing this on top of HN. :)

That message is from me. Nice to see someone using the access for something cool.

One of the reasons I decided to add it there was to give some visibility to this "feature" of EG-25G FW to people interested enough to look at dmesg.

tmzt · 5 years ago
Can you think of a more efficient protocol between the modem and main cpu then the AT-based ril with constant status checks? Is there anyway to make the modem more efficient, since its cpu is just consuming power and not adding much to the functionality of the phone? Can it be a smarter gateway that only triggers a main cpu wakeup when there's something important to notify the user of, like an incoming call or sms?
megous · 5 years ago
> Can it be a smarter gateway that only triggers a main cpu wakeup when there's something important to notify the user of, like an incoming call or sms?

That's how it works.

> Is there anyway to make the modem more efficient, since its cpu is just consuming power and not adding much to the functionality of the phone?

Modem is sleeping most of the time. (at least with my driver) It's much more efficient than the main A64 SoC. Like 10mW sleep vs 100mW sleep.

> Can you think of a more efficient protocol between the modem and main cpu then the AT-based ril with constant status checks?

ModemManager/ofono are not using AT interface, I think. They are using QMI.

Anyway, you don't need constant status checks even with AT interface. You just enable status indications you want to receive and that's what you'll get without polling.

And you can setup wakeup on call/sms too.

xx_ns · 5 years ago
Brilliant! Thanks for drawing attention to this "feature".

The world is a small place indeed.

asadhaider · 5 years ago
According to this[0] which is a neat read anyway, it "has 256 MiB DRAM, 256 MiB NAND, and a single Cortex-A7 CPU clocked up to 1.3GHz."

You can run DNS, a VPN, or a small web server even on a VPS with 32MB of RAM so those are pretty cool specs.

[0] https://xnux.eu/devices/feature/modem-pp.html

vidarh · 5 years ago
My first job was an ISP I co-founded. Our first dial-up system was a classic 120MHz Pentium w/128MB RAM and 4GB harddrive, that served as the terminal server for 16 phone lines and let users start SLIP/PPP or a shell connection. It was not unusual to have 16 users logged into it at once running applications on it.

It also was our main e-mail server and web server, hosting both our own website and several customer websites. We had a second one of the same specs for a few other things and backups, but that was our main workhorse.

[EDIT: They were running Linux 1.0 and 1.2, first with NCSA httpd, then Apache; when we first got them they ran Slackware, installed from floppies; I think we ended up installing Redhat at some point before we retired them; the modems were hanging off Cyclades serial cards; and they were literally hanging - for our first 16 lines we had US Robotics Sportster modems hanging on the wall. (I'm writing this in the hope someone will tell me to get off their lawn and tell me how they did more with less, btw.) ]

fouc · 5 years ago
Wow, that's probably about the same ram & cpu as my desktop 16 years ago.
oblio · 5 years ago
I started with a Pentium I, 166Mhz, 16MB, 1GB HDD, and I'm not even that old. I imagine we have folks here that started on a PDP :-)

My P1 would stutter while playing MP3s :-))

lormayna · 5 years ago
I bought my first PC in the late 80s. It was an 8086 by Amstrad, with a 4Mhz processor, 512kb of RAM and no HDD. It was running MS DOS 3.30 Plus and I made my first programs in GW-Basic.
anthk · 5 years ago
My Athlon in 2003 was partnered with 256MB of RAM and a Geforce 2 MX 200/400.
marcodiego · 5 years ago
These modems are way powerful. This reinforces the need of open source firmware for them. They run their own OS and can stay on independent of the rest of the hardware consuming very little power. Imagine putting your computer to sleep while downloads continue and can survive geographical network migration.

A fully open source firmware for GPS/LTE modem is badly needed.

rsync · 5 years ago
"They run their own OS and can stay on independent of the rest of the hardware consuming very little power."

It's worse - there's a second, independent computer inside your phone that you have no control over: the SIM card.

The SIM is a standalone computer with its own processor and memory which your carrier can communicate with and upload programs to run on it without your knowledge ("OTA updates", etc.)

https://osmocom.org/projects/cellular-infrastructure/wiki/SI...

ftp://www.3gpp.org/tsg_sa/WG3_Security/TSGS3_30_Povoa/Docs/PDF/S3-030534.pdf

adamnew123456 · 5 years ago
Seeing the ShadySIM project mentioned on that page reminded me of this DEFCON talk, which talks about some of the capabilities of the SIM OS (some of them run Java!) and what power they grant you over phones if you have control over the underlying cell network (legitimately or otherwise).

https://www.youtube.com/watch?v=31D94QOo2gY

dcposch · 5 years ago
Do esims fix this problem? Increasingly the norm, no physical sim card at all.
de6u99er · 5 years ago
Yeah, that's nuts and frightening.
monocasa · 5 years ago
And you see some of what you're talking about in closed systems too, where the system integrator can control both sides.

The Wii, and PlayStations since the PS3 have had system control processors that can perform downloads, updates, and general system maintenance on a low power processors even while the majority of the system is off. In the Wii that processor was also responsible for the majority of the network stack even when accessed from the main processor. On the PS4 that processor even ran a relatively complete FreeBSD.

Democratizing these techniques would be killer.

bogwog · 5 years ago
So a modem on a pine phone can survive the HN hug of death (and the number one post no less)? Am I missing something here? Because there's no way I believe that!
yakubin · 5 years ago
HN traffic isn't all that demanding[1]. Websites falling under the load are a testament to the poor quality of the software stack used to host them.

[1]: <https://xyrillian.de/thoughts/posts/latency-matters-aftermat...>

majewsky · 5 years ago
Hey look, it's my blog. It's a small world. :)

Since we're here, I did a quick grep through today's access log. It appears that your link got me 573 visitors to that article and 56 people clicking through to the other article linked therein.

throwaway189262 · 5 years ago
One of my favorite bike shedding topics.

My mind is blown that anyone writes software for stacks that max out at few hundred requests per second.

Everything I've seen comparing "high level" languages says programmers work around the same efficiency whatever the language. So why isn't everything done in Go, C#, and Java where 100,000 requests/second is trivial?

Even if you don't have much load, isn't the possibiliy of a cat DDoS'ing you by sleeping on someone's F5 key at least slightly concerning?

I swear half these companies that claim their site is "being DDoS'ed!" it's just somebody just running HTTrack to archive an article they like.

caslon · 5 years ago
A static site is really easy to host and HN's hug of death isn't actually that intense; the site itself only gets like six million views a day, a fraction of those click on every link, and no syndicated page has much reach.
jerf · 5 years ago
People badly overestimate what it takes to serve a website nowadays. I don't know whether it's just because we're all used to 10+ second website loads as our browser groans under the weight of all the trackers, or if we all have too much experience with web pages that run multiple 10ms+ unoptimized queries against databases that pull way too much data back, etc. and so we all think web pages are some sort of challenge, but webpages themselves really aren't that hard. It's all the stuff you're trying to put in to them that is the challenge.

I hit SHIFT-CTRL-r to watch the page reload under the network debugger so I could get a snapshot of the total size, which looks to be about 100KB, just eyeballing the sums, so at 10MB/s it should be able to serve around 100 requests/second, which is enough for most websites, even ones getting hugged.

stadium · 5 years ago
I recently migrated a personal blog running on a hugo static site to digital ocean with automated github deployment, SSL certificates, CDN, and a custom domain. It took all of 15 minutes including updating the DNS on my custom domain registrar.

Deleted Comment

mrb · 5 years ago
Yes it can survive the HN hug of death.

I speak as a software engineer whose blog has hit the HN frontpage multiple times, and who has optimized my blog to be static & lightweight, just like the author. In my experience, a front-page HN post (in the top 3) leads to 30-40 page hits per second. The page at https://nns.ee/blog/2021/04/01/modem-blog.html weights 44.4 kB transferred (HTML, CSS, images, fonts, etc, all compressed over HTTPS). So this is 11-15 Mbit/s of peak bandwidth, below the maximum throughput the author measured on the Pine phone modem (20.7 Mbit/s).

And the bottleneck is going to be purely network. Not CPU. Not disk. Just serving a small set of files cached in RAM by the pagecache.

kelnos · 5 years ago
It's above the max, no? The author measured 20Mbps between the phones main OS and the rest of the world, but 10Mbps between the phone and the modem (over the adb bridge).
ognarb · 5 years ago
My website also got multiple times in the HN frontpage and there was never any lags even on a very cheap VPS. The websites that get the HN hug of death are often the one requiring database access (e.g. wordpress).
cormorant · 5 years ago
Something in front of it, maybe? It reports nginx.

  $ curl --head 'https://nns.ee/blog/2021/04/01/modem-blog.html'
  HTTP/2 200 
  server: nginx
  date: Fri, 02 Apr 2021 13:28:26 GMT
  content-type: text/html
  content-length: 12937
  last-modified: Fri, 02 Apr 2021 09:40:40 GMT
  etag: "6066e698-3289"
  accept-ranges: bytes

tyingq · 5 years ago
The op mentions in another comment that he has nginx in front: https://news.ycombinator.com/item?id=26670500

No idea if he's caching there, though.

PragmaticPulp · 5 years ago
Could be. The statuspage from the device shows darkhttpd as the server, not nginx: https://nns.ee/blog/status.html
IgorPartola · 5 years ago
Currently can’t load the site.

But also, serving static content is more or less a matter of network connection speed. You can cache everything in RAM and write data to a socket very quickly. HTTPS makes things a little wonky because you can’t just sendfile() files directly into a socket but the overhead is still pretty minimal.

folmar · 5 years ago
I think you can now. You can have TLS handled by the kernel

  setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls"));

Deleted Comment

andai · 5 years ago
HN itself runs on one core.
vmception · 5 years ago
Its uncached database hits that crash sites.

You pretty much never need that, but many/most sites do it somewhere anyway.

A static site running on a modem should be fine, but there is nothing saying they cant/arent using a CDN too, which would be even better.

Matthias247 · 5 years ago
See the first two words in the post: "No, really."

It was just used to catch attention.

But with a CDN in front it might likely work out.

MayeulC · 5 years ago
Slightly misleading title. This blog post is not hosted over LTE. Instead, the web server just happens to run inside the Pinephone modem.

Internet --> USB --> Pinephone CPU --> (ADB forwarding) --> Pinephone modem with webserver.

That's cool, but I am slightly disappointed. I was hoping to find out that some ISPs allowed to forward ports over LTE.

Here, I don't really see the advantage over doing it on the main CPU, since it will have to forward packets anyway. And you can use the same reasoning with whatever the pinephone is connected to.

xx_ns · 5 years ago
Sorry if it's a bit misleading! Wasn't my intention.

However, there's nothing stopping me from getting a data SIM from my provider (who does allow forwarding ports over LTE). I just currently don't have any spare SIM cards at hand. But that is the plan.

MayeulC · 5 years ago
Ah, that would be quite awesome in my opinion.

Although the latency will likely skyrocket, I would be very interested in measuring the energy efficiency. The main CPU could even be completely shut down.

You can even imagine calling the main CPU as backup if there are too many incoming requests, though it would be better to use a (likely available) ethernet-over-USB instead of ADB forwarding, and that scenario is unlikely if just for a static blog.

Anyway, if you do so, please make sure to publish a new blog post, post it here, and plot the power consumption during the hug. That would be some interesting data!

DaniloDias · 5 years ago
You can get carrier grade connections that would allow this kind of routing- it is not part of a standard consumer package. This type of capability is managed via the "Access Point Name" feature in phones.
ashkankiani · 5 years ago
I had been looking to do this exact thing for so long. It didn't occur to me that it was possible to unlock the AT commands for the pinephone. I just wanted to turn it into a modem. It's a pretty solid price for that piece of tech alone, since dev kit LTE modem boards are >$100 in all the places I could find.

Thank you, sincerely!

captainmuon · 5 years ago
The Quectel modems are fun parts. We are using one in a project as a kind of theft protection. I couldn't belive at first "this is a whole computer with Linux on it".

I really wonder why modem manufacturers feel the need to encapsulate everything so much. Is it for regulatory reasons, to protect their secret sauce, or for our convenience? On the one hand it makes simple things really easy with some AT commands, on the other hand it makes debugging quite frustrating because it is a black box.

Tuna-Fish · 5 years ago
Regulatory reasons. There are a lot of things that FCC regs say that devices that transmit either must or must not do, which made more sense back when everything was analog. Now that the device is a full computer and can be programmed to do whatever you want, the way the industry has decided to best fulfill all those requirements is to make the computer do exactly and only what is required and then lock it down into a black box.

If you just unlocked everything, it would probably be better at what it does, but it would also not be possible to sell to consumers.

unnah · 5 years ago
Do those regulations explicitly say that the RF device is not allowed to be programmable by the user? And isn't the user legally forbidden from substantially modifying the RF behaviour in any case?
scoutt · 5 years ago
> I really wonder why modem manufacturers feel the need to encapsulate everything so much.

The alternative would be using an RTOS of some sort, implementing a full network stack (with > 100Mb throughput) and a USB device, as the bare minimum. Then you also have I2S audio, GNSS, etc.

It probably makes more sense using an entire OS at some point.

BTW, this is typical Qualcomm, that makes the chipsets for these modems.

ashkankiani · 5 years ago
I've been playing with the ESP32's a lot more recently (which go the RTOS route), and in reading the code for network stacks for these devices, it did occur to me how simple they were in terms of features. I wouldn't say that one needs the entirety of the Linux kernel to be able to implement all of those things, but it does build off of a more well used stack and reuses a lot of well-tested components.

So from this perspective, it's honestly more secure probably, too, as opposed to trusting a hardware company to hire embedded software engineers to reinvent an entire stack from scratch. The latter of which are in rare supply and we all know that reinventing things is a process that often leads to vulnerabilities.

Locking down the communication to just AT commands then makes sense for similar reasons.

Nextgrid · 5 years ago
Why not offload all that to the driver running on the main application processor? The risk of having a second, black-box running Linux is that it’ll get outdated and/or compromised and used as a persistence mechanism for malware.
jcims · 5 years ago
Sounds like it would make a good payload for a high-altitude balloon ride to send live data on the way up and back down (to whatever range limits)
gsich · 5 years ago
Baseband: yes

Rest: no. Some modem manufacturers have SDKs to get your application on the device as a feature.

imhoguy · 5 years ago
This is realy cool!

I wonder if Justine's Redbean[0] webserver, which got recently posted on HN[1], would support ARM in such use case. Its executable size is 460KB, it even allows Lua scripting, and benchmarks 1 million pages per second on desktop PC.

[0] https://justine.lol/redbean/index.html [1] https://news.ycombinator.com/item?id=26271117

pantalaimon · 5 years ago
gatling [0] is also pretty small and fast, it also can do FTP and SMB if you need that.

[0] https://www.fefe.de/gatling/

mfashby · 5 years ago
Possibly not. I believe that runs natively on (any!) x86 system, but it uses QEMU to run on ARM, which might make things a big too big here.
spijdar · 5 years ago
While you'll probably run out of memory first, there's the enormous overhead of running qemu's translation, too. Using QEMU to emulate x86 on my POWER9 system, I get... roughly the performance of a 2001-2004 pentium processor, and the host cpu is running at 3.8GHz and comparable speed wise to a 2018ish intel processor.

In spite of the author's insistence, I don't think Cosmopolitan is really usable on anything but x86, the QEMU thing is more a cute proof-of-concept. For very simple programs I guess...

imhoguy · 5 years ago
You are right. Indeed it falls back to QEMU on non-x86_64 https://github.com/jart/cosmopolitan/issues/73#issuecomment-...

Running QEMU on a modem would be another hack for a day :)

bayindirh · 5 years ago
Don't forget webfs. It's just 196K installed.