Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2022 11:22:39 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Stefan Blachmann <sblachmann@gmail.com>
Cc:        Joseph Mingrone <jrm@freebsd.org>, =?UTF-8?B?w5Z6a2FuIEtJUklL?= <ozkan.kirik@gmail.com>,  Michael Schuster <michaelsprivate@gmail.com>, Kyle Evans <kevans@freebsd.org>,  Karel Gardas <gardask@gmail.com>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: 7.0 points 5.1 points Re: Call for Foundation-supported Project Ideas
Message-ID:  <CANCZdfoRLM2VdGCGZAEeMF0Wt%2Bw0VZ20Zr1c0F14xLUcUFPPdg@mail.gmail.com>
In-Reply-To: <CACc-My0NLTpH6Ttogcx6-XD1svsbVpg5kJaH5v8r=CiQ%2BXvMkg@mail.gmail.com>
References:  <861r36xzpe.fsf@phe.ftfl.ca> <61100a28-40ae-4458-d7d5-3bc9b13ba219@gmail.com> <CADqw_gKkii%2BBHk7_jPE0DV5ZdF86ydEq956WDtZOP1N9GBjAPw@mail.gmail.com> <CACNAnaH4GH_n8GVYN44op-VO7VZ5_GLP8SBj0SfoC5KoBSFDQw@mail.gmail.com> <CADqw_gJuU6_Wt-GEJduz_Tm0oQg4dDv-5XDz1bsgWqtCmp1R2w@mail.gmail.com> <CAAcX-AHCom%2B5Zf2ENf%2BcFxPDrCWY=e_EaXfRamd%2BwnynBn1-VQ@mail.gmail.com> <864k6qj6x6.fsf@phe.ftfl.ca> <86zgoihs64.fsf@phe.ftfl.ca> <CACc-My26b1GZ7_s93Jx-DgeA=8%2BdS_2MYSoCv_D6uzRihyNHNQ@mail.gmail.com> <CANCZdfq7s2ODPbrZRztXQ7q1aMeDtK-bsoEoW%2BZKDkiyktKUSQ@mail.gmail.com> <CACc-My1WHdgxidCiYDW2RrWxM4sKao7o_Tw-pZuuE_Y0WXC4JQ@mail.gmail.com> <CANCZdfpb=Oq1hgLRYk59duCRgVjVtu5bd4VAKR8wbgJdoi9vDg@mail.gmail.com> <CACc-My0NLTpH6Ttogcx6-XD1svsbVpg5kJaH5v8r=CiQ%2BXvMkg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000006d458005d4d9d7ee
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 5, 2022, 10:09 AM Stefan Blachmann <sblachmann@gmail.com> wrote=
:

> On 1/4/22, Warner Losh <imp@bsdimp.com> wrote:
> > 15 or 20 years [...]
> > main reason laptops stopped suspending in the early 2000s... [...]
> > And the INT xx interface is unavailable on amd64 after we
> > enter long mode
>
> First, you mentioned a hacking session in the "early 2000s".
> This makes me wonder whether you might mistake some other thing from
> the distance of time, as UEFI was no real thing until ~2010, and was
> never a thing on platforms other than amd64 also. Suspend/resume on
> FreeBSD only appeared much later, too.
>

You do know you are talking to someone who has been working on suspend /
resume since I got my first Libretto 50CT laptop in the FreeBSD 3.2 days,
right? I'll assume not, because otherwise this is somewhat insulting. I
wrote a lot of the original suspend/resume code. I worked on it with the
transition to ACPI. I saw the code stop working when the GPUs started
needing more state restored than could be done with INT10 interfaces. I
tried to implement that on suspend/resume. I helped get workarounds for X11
on suspend/resume to switch to ttyv0 before suspending (which worked for a
while, pre drm days). What you say here is factually inaccurate.

Second, there is kernel functionality to call real mode interrupt
> handlers from long mode, which manage switching to real mode and back.
> Just an example, these are being used by vt (via vesa.ko) to switch vesa
> modes.
>

Except that it's kinda unreliable and not enabled for vt because it doesn't
work well with UEFI.

So I do not see why this real mode access infrastructure could not
> also be used to make a call to C000:(PCI PROM Programming interface
> code offset), or the respective segment address where the actual VGA
> BIOS is, to have it initialize the int 10h interface handler, if a
> hybrid/dual graphics card BIOS is present.
> I think a single function "InitializeVGABIOSifpresent" to enable
> access to VGA/VESA BIOS functionality might actually be fairly easy to
> implement.
> Furthermore, there is no need at all to access hardware specific stuff
> like you mentioned, as the necessary functionality is completely
> covered by the int 10h


Imho it could be worth to allocate a small part of the sponsoring
> budget to put a bounty to motivate people (including possibly me) to
> implement these improvements regarding suspend/resume and enhanced sc
> and vt usability.
>

I'm going to disagree.

Why bother. Load the kms drm drivers. The suspend/resume code is in those
drivers. They work console, X11 and wayland, more or less.  It's an
absolutely
insane idea to spend limited funds on the crazy ideas presented in this
thread.
They are known to be flakey, unreliable or technically just not possible.

Warner


On 1/4/22, Warner Losh <imp@bsdimp.com> wrote:
> > On Tue, Jan 4, 2022 at 12:14 AM Stefan Blachmann <sblachmann@gmail.com>
> > wrote:
> >
> >> On 1/4/22, Warner Losh <imp@bsdimp.com> wrote:
> >> > Not without loading the xorg graphics stuff... graphics chips from t=
he
> >> last
> >> > 15 or 20 years have lots of chip specific state that only the graphi=
cs
> >> > stuff knows about... IIRC, it only knows about it because it put the
> >> > graphics into a known state... it's the main reason laptops stopped
> >> > suspending in the early 2000s... it looks to be a lot of work for a
> >> > relatively rare use case...
> >>
> >> UEFI GOP seems to have the necessary functionalities
> >> (https://wiki.osdev.org/GOP#Get_the_Current_Mode) so I guess the work
> >> required would be limited (restore mode and redraw screen from
> >> buffer).
> >>
> >
> > UEFI GOP isn't available after we start the kernel, so this is a
> > non-starter.
> > It works great in the boot loader, but not so good after we boot. It
> could
> > work
> > for S3 sleep to disk where we actually reboot to restore the machine
> state,
> > but we don't have sleep to disk today :(
> >
> >
> >> With non-UEFI or old UGA UEFI implementations possibly one could use
> >> the dual BIOS=C2=B4 CSM part. Just call the CSM BIOS init to set up GP=
U and
> >> the int 10h interface, and then set previously used mode+redraw.
> >> BTW, doing that also could both enable vt(4) to change
> >> modes/resolutions and using sc on UEFI computers.
> >>
> >
> > Ah, if only things were really that simple...  I tried variations on th=
at
> > hack years ago when suspending broke due to video. And it
> > works for some machines, but not others, was the quick assessment
> > I made. And the INT xx interface is unavailable on amd64 after we
> > enter long mode (I tried this out on my then-current FreeBSD laptop
> > which was 32 bit only, so 15 years ago?).
> >
> > Warner
> >
> >
> >> But I think you are right, there are probably not too many users who
> >> would make use of that.
> >>
> >>
> >> On 1/4/22, Warner Losh <imp@bsdimp.com> wrote:
> >> > On Mon, Jan 3, 2022, 11:03 PM Stefan Blachmann <sblachmann@gmail.com=
>
> >> > wrote:
> >> >
> >> >> Implementing S3 suspend/resume was a sponsored project itself.
> >> >> However, it still does only work when at xorg graphics mode, which
> >> >> already was topic in this thread.
> >> >> When using it from console, no matter sc or vt, it still hangs with
> >> >> dark screen and unresponsive keyboard.
> >> >> Could finishing the suspend/resume work be sponsored, so that it al=
so
> >> >> works on console-only computers?
> >> >>
> >> >
> >> > Not without loading the xorg graphics stuff... graphics chips from t=
he
> >> last
> >> > 15 or 20 years have lots of chip specific state that only the graphi=
cs
> >> > stuff knows about... IIRC, it only knows about it because it put the
> >> > graphics into a known state... it's the main reason laptops stopped
> >> > suspending in the early 2000s... it looks to be a lot of work for a
> >> > relatively rare use case...
> >> >
> >> > Warner
> >> >
> >> >
> >> >> On 12/30/21, Joseph Mingrone <jrm@freebsd.org> wrote:
> >> >> > On Thu, 2021-12-30 at 14:15, Joseph Mingrone <jrm@FreeBSD.org>
> >> >> > wrote:
> >> >> >
> >> >> >> On Thu, 2021-12-30 at 08:05, =C3=96zkan KIRIK <ozkan.kirik@gmail=
.com>
> >> >> >> wrote:
> >> >> >>> I've ideas about enhancing the routing architecture. Is it
> >> >> >>> possible
> >> >> >>> to
> >> >> >>> add to wiki?
> >> >> >
> >> >> >> Certainly.  Please do.
> >> >> >
> >> >> > The link again is https://wiki.freebsd.org/2021FoundationCFI
> >> >> >
> >> >>
> >> >>
> >> >
> >>
> >
>
>
>

--0000000000006d458005d4d9d7ee
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"auto"><div><br><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Wed, Jan 5, 2022, 10:09 AM Stefan =
Blachmann &lt;<a href=3D"mailto:sblachmann@gmail.com" target=3D"_blank">sbl=
achmann@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote"=
 style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On=
 1/4/22, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" rel=3D"noreferre=
r" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br>
&gt; 15 or 20 years [...]<br>
&gt; main reason laptops stopped suspending in the early 2000s... [...]<br>
&gt; And the INT xx interface is unavailable on amd64 after we<br>
&gt; enter long mode<br>
<br>
First, you mentioned a hacking session in the &quot;early 2000s&quot;.<br>
This makes me wonder whether you might mistake some other thing from<br>
the distance of time, as UEFI was no real thing until ~2010, and was<br>
never a thing on platforms other than amd64 also. Suspend/resume on<br>
FreeBSD only appeared much later, too.<br></blockquote></div></div><div dir=
=3D"auto"><br></div><div dir=3D"auto">You do know you are talking to someon=
e who has been working on suspend / resume since I got my first Libretto 50=
CT laptop in the FreeBSD 3.2 days, right? I&#39;ll assume not, because othe=
rwise this is somewhat insulting. I wrote a lot of the original suspend/res=
ume code. I worked on it with the transition to ACPI. I saw the code stop w=
orking when the GPUs started needing more state restored than could be done=
 with INT10 interfaces. I tried to implement that on suspend/resume. I help=
ed get workarounds for X11 on suspend/resume to switch to ttyv0 before susp=
ending (which worked for a while, pre drm days). What you say here is factu=
ally inaccurate.</div><div dir=3D"auto"><br></div><div dir=3D"auto"><div cl=
ass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Second, there is kernel functionality to call real mode interrupt<br>
handlers from long mode, which manage switching to real mode and back.<br>
Just an example, these are being used by vt (via vesa.ko) to switch vesa mo=
des.<br></blockquote></div></div><div dir=3D"auto"><br></div><div>Except th=
at it&#39;s kinda unreliable and not enabled for vt because it doesn&#39;t =
work well with UEFI.</div><div dir=3D"auto"><br></div><div dir=3D"auto"><di=
v class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So I do not see why this real mode access infrastructure could not<br>
also be used to make a call to C000:(PCI PROM Programming interface<br>
code offset), or the respective segment address where the actual VGA<br>
BIOS is, to have it initialize the int 10h interface handler, if a<br>
hybrid/dual graphics card BIOS is present.<br>
I think a single function &quot;InitializeVGABIOSifpresent&quot; to enable<=
br>
access to VGA/VESA BIOS functionality might actually be fairly easy to<br>
implement.<br>
Furthermore, there is no need at all to access hardware specific stuff<br>
like you mentioned, as the necessary functionality is completely<br>
covered by the int 10h</blockquote></div></div><div dir=3D"auto"><br></div>=
<div dir=3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
>
Imho it could be worth to allocate a small part of the sponsoring<br>
budget to put a bounty to motivate people (including possibly me) to<br>
implement these improvements regarding suspend/resume and enhanced sc<br>
and vt usability.<br></blockquote></div></div><div dir=3D"auto"><br></div><=
div>I&#39;m going to disagree.</div><div><br></div><div>Why bother. Load th=
e kms drm drivers. The suspend/resume code is in those</div><div>drivers. T=
hey work console, X11 and wayland, more or less.=C2=A0 It&#39;s an absolute=
ly</div><div>insane idea to spend limited funds on the crazy ideas presente=
d in this thread.</div><div>They are known to be flakey, unreliable or tech=
nically just not possible.</div><div><br></div><div>Warner</div><div dir=3D=
"auto"><div class=3D"gmail_quote"><div><br></div><div><br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex">
On 1/4/22, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" rel=3D"norefer=
rer" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br>
&gt; On Tue, Jan 4, 2022 at 12:14 AM Stefan Blachmann &lt;<a href=3D"mailto=
:sblachmann@gmail.com" rel=3D"noreferrer" target=3D"_blank">sblachmann@gmai=
l.com</a>&gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;&gt; On 1/4/22, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" rel=
=3D"noreferrer" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Not without loading the xorg graphics stuff... graphics chips=
 from the<br>
&gt;&gt; last<br>
&gt;&gt; &gt; 15 or 20 years have lots of chip specific state that only the=
 graphics<br>
&gt;&gt; &gt; stuff knows about... IIRC, it only knows about it because it =
put the<br>
&gt;&gt; &gt; graphics into a known state... it&#39;s the main reason lapto=
ps stopped<br>
&gt;&gt; &gt; suspending in the early 2000s... it looks to be a lot of work=
 for a<br>
&gt;&gt; &gt; relatively rare use case...<br>
&gt;&gt;<br>
&gt;&gt; UEFI GOP seems to have the necessary functionalities<br>
&gt;&gt; (<a href=3D"https://wiki.osdev.org/GOP#Get_the_Current_Mode" rel=
=3D"noreferrer noreferrer" target=3D"_blank">https://wiki.osdev.org/GOP#Get=
_the_Current_Mode</a>) so I guess the work<br>
&gt;&gt; required would be limited (restore mode and redraw screen from<br>
&gt;&gt; buffer).<br>
&gt;&gt;<br>
&gt;<br>
&gt; UEFI GOP isn&#39;t available after we start the kernel, so this is a<b=
r>
&gt; non-starter.<br>
&gt; It works great in the boot loader, but not so good after we boot. It c=
ould<br>
&gt; work<br>
&gt; for S3 sleep to disk where we actually reboot to restore the machine s=
tate,<br>
&gt; but we don&#39;t have sleep to disk today :(<br>
&gt;<br>
&gt;<br>
&gt;&gt; With non-UEFI or old UGA UEFI implementations possibly one could u=
se<br>
&gt;&gt; the dual BIOS=C2=B4 CSM part. Just call the CSM BIOS init to set u=
p GPU and<br>
&gt;&gt; the int 10h interface, and then set previously used mode+redraw.<b=
r>
&gt;&gt; BTW, doing that also could both enable vt(4) to change<br>
&gt;&gt; modes/resolutions and using sc on UEFI computers.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Ah, if only things were really that simple...=C2=A0 I tried variations=
 on that<br>
&gt; hack years ago when suspending broke due to video. And it<br>
&gt; works for some machines, but not others, was the quick assessment<br>
&gt; I made. And the INT xx interface is unavailable on amd64 after we<br>
&gt; enter long mode (I tried this out on my then-current FreeBSD laptop<br=
>
&gt; which was 32 bit only, so 15 years ago?).<br>
&gt;<br>
&gt; Warner<br>
&gt;<br>
&gt;<br>
&gt;&gt; But I think you are right, there are probably not too many users w=
ho<br>
&gt;&gt; would make use of that.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On 1/4/22, Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" rel=
=3D"noreferrer" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br>
&gt;&gt; &gt; On Mon, Jan 3, 2022, 11:03 PM Stefan Blachmann &lt;<a href=3D=
"mailto:sblachmann@gmail.com" rel=3D"noreferrer" target=3D"_blank">sblachma=
nn@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; Implementing S3 suspend/resume was a sponsored project it=
self.<br>
&gt;&gt; &gt;&gt; However, it still does only work when at xorg graphics mo=
de, which<br>
&gt;&gt; &gt;&gt; already was topic in this thread.<br>
&gt;&gt; &gt;&gt; When using it from console, no matter sc or vt, it still =
hangs with<br>
&gt;&gt; &gt;&gt; dark screen and unresponsive keyboard.<br>
&gt;&gt; &gt;&gt; Could finishing the suspend/resume work be sponsored, so =
that it also<br>
&gt;&gt; &gt;&gt; works on console-only computers?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Not without loading the xorg graphics stuff... graphics chips=
 from the<br>
&gt;&gt; last<br>
&gt;&gt; &gt; 15 or 20 years have lots of chip specific state that only the=
 graphics<br>
&gt;&gt; &gt; stuff knows about... IIRC, it only knows about it because it =
put the<br>
&gt;&gt; &gt; graphics into a known state... it&#39;s the main reason lapto=
ps stopped<br>
&gt;&gt; &gt; suspending in the early 2000s... it looks to be a lot of work=
 for a<br>
&gt;&gt; &gt; relatively rare use case...<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Warner<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; On 12/30/21, Joseph Mingrone &lt;<a href=3D"mailto:jrm@fr=
eebsd.org" rel=3D"noreferrer" target=3D"_blank">jrm@freebsd.org</a>&gt; wro=
te:<br>
&gt;&gt; &gt;&gt; &gt; On Thu, 2021-12-30 at 14:15, Joseph Mingrone &lt;jrm=
@FreeBSD.org&gt;<br>
&gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; On Thu, 2021-12-30 at 08:05, =C3=96zkan KIRIK &l=
t;<a href=3D"mailto:ozkan.kirik@gmail.com" rel=3D"noreferrer" target=3D"_bl=
ank">ozkan.kirik@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; I&#39;ve ideas about enhancing the routing a=
rchitecture. Is it<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; possible<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt;&gt; add to wiki?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Certainly.=C2=A0 Please do.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; The link again is <a href=3D"https://wiki.freebsd.or=
g/2021FoundationCFI" rel=3D"noreferrer noreferrer" target=3D"_blank">https:=
//wiki.freebsd.org/2021FoundationCFI</a><br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;<br>
<br>
<br>
</blockquote></div></div></div>
</div>

--0000000000006d458005d4d9d7ee--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoRLM2VdGCGZAEeMF0Wt%2Bw0VZ20Zr1c0F14xLUcUFPPdg>