Re: [RFC] On the Current Troubles of Mainlining Loongson Platform Drivers

From: Tom Li
Date: Mon Feb 11 2019 - 07:55:25 EST


On Mon, Feb 11, 2019 at 10:13:00AM -0200, Alexandre Oliva wrote:
> On Feb 8, 2019, Tom Li <tomli@xxxxxxxx> wrote:
>
> > found Alexandre Oliva has stopped maintaining his tree
>
> ?!?
>
> I still merge and tag every one of Torvalds' and Greg KH's releases into
> the loongson-community tree, resolving trivial conflicts and trying to
> verify that it at least builds and passes a smoke test on actual
> hardware (after Linux-libre deblobbing, but still).

What is the current link to your repository? The original one from Lemote
is now a 404, and the GitHub one has been "archived".

> Two issues that bother me a bit are frequent failure to reboot/poweroff,
> that's been around since around 4.10, and, more recently, a very slow
> system overall, that's been present since 4.20. I haven't checked
> whether they're caused by changes in the loongson-community tree that I
> still carry, or if they're already present in upstream releases.
>
> I've already tried to bisect the former, but since the issue is
> intermittent, that proved to be too tricky and time-consuming for me.
>
> I haven't tried to bisect the latter yet.

You cannot bisect it. Because I've tried it for 24 hours without sleep, but
failed. ;-)

We've just identified and confirmed the source of the shutdown problem a
few days ago on this mailing list. It's related to a PREEMPT race condition
in the cpufreq framework that triggers a timing-dependent, probabilistic
lockup in the i8259 PIC driver. And it was first noticed by Ville Syrjälä
on a x86 system, my debugging rediscovered his findings.

You can read the full investigation at here:
https://lkml.org/lkml/2018/11/13/857

You can pick up the patch from:
https://lore.kernel.org/lkml/20190207205812.GA11315@xxxxxxxxxxxxxxxxxxxxxxxxx/

A patch has been authored and submitted by Aaro Koskinen, but currently it
seems stuck in the mailing list because the maintainer worries about regression
and asks for testing on more MIPS systems, although we believe it's a trivial
patch.

In addition, I've discovered and fixed another bug preventing the machine from
shutting down, this patch has already merged into the Linus tree.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8a96669d77897ff3613157bf43f875739205d66d

> and, more recently, a very slow system overall, that's been present since
> 4.20.

The mainline framebuffer driver doesn't have any hardware drawing, printing
even a single line on the console is required a full screen redraw via memory-
mapped I/O over the slow PCI interface. I have rebased the 2D acceleration
code against the latest upstream driver and sent the patch to the fbdev mailing
list on February 2nd.

But the maintainers seem to be working on other tasks and the patches (including
mine and others') on the list didn't receive any response.

It's avaliable from

https://patchwork.kernel.org/project/linux-fbdev/list/?series=75029

> I've considered leaving the loongson-community tree behind and using
> upstream releases, but every time I was about to do that, something else
> came up that led me to keep at it. I think the last such occurrence was
> the removal of the video driver (later reintroduced as a new driver).
> So I've kept at it ;-)

I'll continue working on upstreaming these out-of-tree drivers as my personal
project. I hope you'll be able to use a fully-functional machine with the mainline
kernel soon, my current target is Linux 5.3.

Cheers,
Tom Li

Attachment: signature.asc
Description: PGP signature