* [gentoo-user] console scrollback (kernel 5.14)
@ 2021-09-18 20:40 Jorge Almeida
2021-09-22 20:28 ` Alan Mackenzie
0 siblings, 1 reply; 16+ messages in thread
From: Jorge Almeida @ 2021-09-18 20:40 UTC (permalink / raw
To: gentoo-user
Hello, gentooers in general and Alan in particular
I've been using Alan Mackenzie's patch until kernel 5.13, with
success. It failed with 5.14.4 --yes, I know, but it doesn't hurt to
try :)
Jorge Almeida
Just in case it is useful:
(Stripping trailing CRs from patch; use --binary to disable.)
patching file ./include/linux/vt_kern.h
Hunk #1 succeeded at 115 (offset -12 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file ./include/linux/console_struct.h
Hunk #1 succeeded at 110 (offset 1 line).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file ./drivers/video/fbdev/core/fbcon.c
Hunk #1 succeeded at 3053 with fuzz 2 (offset -31 lines).
(Stripping trailing CRs from patch; use --binary to disable.)
patching file ./drivers/video/console/Kconfig
(Stripping trailing CRs from patch; use --binary to disable.)
patching file ./drivers/tty/vt/vt.c
Hunk #11 succeeded at 1358 with fuzz 2.
Hunk #12 succeeded at 1454 (offset -1 lines).
Hunk #13 succeeded at 1519 (offset -1 lines).
Hunk #16 FAILED at 3264.
Hunk #18 succeeded at 3709 (offset -7 lines).
Hunk #19 succeeded at 3736 (offset -7 lines).
Hunk #20 succeeded at 3797 (offset -7 lines).
Hunk #21 succeeded at 4497 (offset -8 lines).
Hunk #22 succeeded at 4798 (offset -8 lines).
1 out of 22 hunks FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
## cat ./drivers/tty/vt/vt.c.rej
--- ./drivers/tty/vt/vt.c.orig 2020-12-13 22:41:30.000000000 +0000
+++ ./drivers/tty/vt/vt.c 2021-04-05 16:20:32.624563241 +0000
@@ -3264,6 +3640,14 @@
param.vc = vc;
+ /* NEW STOUGH, 2021-04-03 */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
+ not pass through this function. */
+ concon_set_origin (vc);
+#endif
+ /* END OF NEW STOUGH */
+
while (!tty->stopped && count) {
int orig = *buf;
buf++;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-18 20:40 [gentoo-user] console scrollback (kernel 5.14) Jorge Almeida
@ 2021-09-22 20:28 ` Alan Mackenzie
2021-09-22 21:40 ` Jorge Almeida
0 siblings, 1 reply; 16+ messages in thread
From: Alan Mackenzie @ 2021-09-22 20:28 UTC (permalink / raw
To: gentoo-user
Hello, Jorge.
On Sat, Sep 18, 2021 at 21:40:46 +0100, Jorge Almeida wrote:
> Hello, gentooers in general and Alan in particular
> I've been using Alan Mackenzie's patch until kernel 5.13, with
> success. It failed with 5.14.4 --yes, I know, but it doesn't hurt to
> try :)
I'm happy to know my patch is still useful.
I must confess that somebody told me by private email that it fails on
systems which change their screen geometry during boot-up. For example,
a system which first boots into 80x25, then changes to a frame buffer.
I know why this is happening, but I don't have a machine to debug it on,
so the debugging is happening slowly, with the help of my correspondent.
It also doesn't seem to work on machines with kernel parameters such as
vga=791.
That said, I'm hoping that the failure of the patch on 5.14.4 is just a
simple struct change in 5.14, which I hope to have corrected (but in
5.14.5). What used to be
while (!tty->stopped ...
has now become
while (!tty->flow.stopped ...
I'm assuming that the patch you tried to apply was
5.10.49-scroll.20210715.diff. If so, please leave it applied (with the
one failed hunk), and additionally apply this:
--- ./drivers/tty/vt/vt.c.orig 2020-12-13 22:41:30.000000000 +0000
+++ ./drivers/tty/vt/vt.c 2021-04-05 16:20:32.624563241 +0000
@@ -3208,6 +3208,12 @@
param.vc = vc;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
+ not pass through this function. */
+ concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;
As always, there are no guarantees. Please let me know whether or not
the above hunk applies, and if so, whether or not the scrolling still
works. (Also, feel free to send me private email if there're any
problems with the mechanics of applying the patch.)
Thanks!
> Jorge Almeida
> Just in case it is useful:
It was, thanks!
[ .... ]
> param.vc = vc;
> + /* NEW STOUGH, 2021-04-03 */
> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
> + /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
> + not pass through this function. */
> + concon_set_origin (vc);
> +#endif
> + /* END OF NEW STOUGH */
> +
> while (!tty->stopped && count) { <==========================
> int orig = *buf;
> buf++;
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-22 20:28 ` Alan Mackenzie
@ 2021-09-22 21:40 ` Jorge Almeida
2021-09-23 18:03 ` Alan Mackenzie
0 siblings, 1 reply; 16+ messages in thread
From: Jorge Almeida @ 2021-09-22 21:40 UTC (permalink / raw
To: gentoo-user
On Wed, Sep 22, 2021 at 9:29 PM Alan Mackenzie <acm@muc.de> wrote:
>
> Hello, Jorge.
>
Hi Alan, thanks for the reply
> I must confess that somebody told me by private email that it fails on
> systems which change their screen geometry during boot-up. For example,
> a system which first boots into 80x25, then changes to a frame buffer.
> I know why this is happening, but I don't have a machine to debug it on,
> so the debugging is happening slowly, with the help of my correspondent.
>
> It also doesn't seem to work on machines with kernel parameters such as
> vga=791.
OK, I don't know much about this kind of stuff, but I don't think
there's a problem there. I have an integrated GPU (intel), driver
i915, resolution 1920x1080. It boots (via Refind) with the proper
resolution, and that's it. All the VTs show the same resolution and
font. I don't use a login manager. No problems, no change is supposed
to happen. I start an X session from a login shell, in any VT except
tty1, which I like to keep as console.
>
> I'm assuming that the patch you tried to apply was
> 5.10.49-scroll.20210715.diff. If so, please leave it applied (with the
> one failed hunk), and additionally apply this:
>
I may have missed some announcement from you, I'm using
diff.20210405.diff. I wasn't aware of newer versions. Is there an URL
to download it? I would try it before trying to apply the patch
included in your message.
Thanks,
Jorge Almeida
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-22 21:40 ` Jorge Almeida
@ 2021-09-23 18:03 ` Alan Mackenzie
2021-09-24 8:22 ` Jorge Almeida
0 siblings, 1 reply; 16+ messages in thread
From: Alan Mackenzie @ 2021-09-23 18:03 UTC (permalink / raw
To: gentoo-user
Hello, Jorge.
On Wed, Sep 22, 2021 at 22:40:11 +0100, Jorge Almeida wrote:
> On Wed, Sep 22, 2021 at 9:29 PM Alan Mackenzie <acm@muc.de> wrote:
> Hi Alan, thanks for the reply
> > I must confess that somebody told me by private email that it fails on
> > systems which change their screen geometry during boot-up. For example,
> > a system which first boots into 80x25, then changes to a frame buffer.
> > I know why this is happening, but I don't have a machine to debug it on,
> > so the debugging is happening slowly, with the help of my correspondent.
> > It also doesn't seem to work on machines with kernel parameters such as
> > vga=791.
> OK, I don't know much about this kind of stuff, but I don't think
> there's a problem there. I have an integrated GPU (intel), driver
> i915, resolution 1920x1080. It boots (via Refind) with the proper
> resolution, and that's it. All the VTs show the same resolution and
> font. I don't use a login manager. No problems, no change is supposed
> to happen. I start an X session from a login shell, in any VT except
> tty1, which I like to keep as console.
Sounds pretty much like my setup. :-)
> > I'm assuming that the patch you tried to apply was
> > 5.10.49-scroll.20210715.diff. If so, please leave it applied (with the
> > one failed hunk), and additionally apply this:
> I may have missed some announcement from you, I'm using
> diff.20210405.diff. I wasn't aware of newer versions. Is there an URL
> to download it? I would try it before trying to apply the patch
> included in your message.
I'm currently discovering what version control systems are for. :-(
Even though I've only posted two or three versions of my patch, I'm
already having difficulty keeping track of it. I no longer believe
keeping the patch informally is going to work. I think I'm going to
have to clone the git repository of the kernel (about which I'm going to
ask on another thread).
Anyhow, back to the topic. There's no URL with my patch; it's purely
posted on gentoo-users. Maybe I should put it into the Gentoo wiki.
But first, I must get it into a proper VCS.
As for the two(?) versions of my patch, they differed mainly in the
aesthetics - diff.20210405.diff had lots of ugly maintainer comments in
it. So, could I ask you please to try that 1-hunk patch I posted
yesterday on top of the version you have. Please then tell me whether
or not it works.
I am going to get this unsystematic muddle sorted out.
> Thanks,
> Jorge Almeida
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-23 18:03 ` Alan Mackenzie
@ 2021-09-24 8:22 ` Jorge Almeida
2021-09-24 17:29 ` Alan Mackenzie
0 siblings, 1 reply; 16+ messages in thread
From: Jorge Almeida @ 2021-09-24 8:22 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
On Thu, Sep 23, 2021 at 6:03 PM Alan Mackenzie <acm@muc.de> wrote:
>
>
> As for the two(?) versions of my patch, they differed mainly in the
> aesthetics - diff.20210405.diff had lots of ugly maintainer comments in
> it. So, could I ask you please to try that 1-hunk patch I posted
> yesterday on top of the version you have. Please then tell me whether
> or not it works.
>
It still fails:
$ patch -p0 <../patch_for_5.14.diff
patching file ./drivers/tty/vt/vt.c
Hunk #1 FAILED at 3208.
1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
$ cat ../patch_for_5.14.diff
--- ./drivers/tty/vt/vt.c.orig 2020-12-13 22:41:30.000000000 +0000
+++ ./drivers/tty/vt/vt.c 2021-04-05 16:20:32.624563241 +0000
@@ -3208,6 +3208,12 @@
param.vc = vc;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
+ not pass through this function. */
+ concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;
Thanks,
Jorge Almeida
[-- Attachment #2: vt.c.rej --]
[-- Type: text/x-reject, Size: 501 bytes --]
--- ./drivers/tty/vt/vt.c.orig 2020-12-13 22:41:30.000000000 +0000
+++ ./drivers/tty/vt/vt.c 2021-04-05 16:20:32.624563241 +0000
@@ -3208,6 +3208,12 @@
param.vc = vc;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
+ not pass through this function. */
+ concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-24 8:22 ` Jorge Almeida
@ 2021-09-24 17:29 ` Alan Mackenzie
2021-09-24 23:44 ` Jorge Almeida
2021-09-25 10:14 ` Peter Humphrey
0 siblings, 2 replies; 16+ messages in thread
From: Alan Mackenzie @ 2021-09-24 17:29 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]
Hello, Jorge.
On Fri, Sep 24, 2021 at 09:22:45 +0100, Jorge Almeida wrote:
> On Thu, Sep 23, 2021 at 6:03 PM Alan Mackenzie <acm@muc.de> wrote:
[ .... ]
> It still fails:
> $ patch -p0 <../patch_for_5.14.diff
> patching file ./drivers/tty/vt/vt.c
> Hunk #1 FAILED at 3208.
> 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
Apologies once more. Late last night I managed to get a Linux kernel
git repository set up. :-) So, at least if there are any more
failures, they'll be systematic failures rather than erratic failures.
;-)
From this I've constructed a complete clean 5.14.5 patch, which I've
attached. Please start again from a gentoo-sources without any previous
traces of the scrollback patches, and apply that patch. _Surely_ it
should work this time.
To apply the patch (you surely know this already), cd to the top of the
kernel tree, and use
$ patch -p1 < 5.14.5-scroll-20210924.diff
.. Alternatively, if you've got git, you could use
$ git apply 5.14.5-scroll-20210924.diff
.. Please let me know again how it works out. Thanks!
[ .... ]
> Thanks,
> Jorge Almeida
--
Alan Mackenzie (Nuremberg, Germany).
[-- Attachment #2: 5.14.5-scroll-20210924.diff --]
[-- Type: text/plain, Size: 20783 bytes --]
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index ef981d3b7bb4..17b51bdc9f6e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -134,6 +134,11 @@ const struct consw *conswitchp;
#define DEFAULT_BELL_DURATION (HZ/8)
#define DEFAULT_CURSOR_BLINK_MS 200
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static unsigned int console_soft_scrollback_size =
+ 1024 * CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE;
+#endif
+
struct vc vc_cons [MAX_NR_CONSOLES];
#ifndef VT_SINGLE_DRIVER
@@ -287,7 +292,7 @@ static inline unsigned short *screenpos(const struct vc_data *vc, int offset,
bool viewed)
{
unsigned short *p;
-
+
if (!viewed)
p = (unsigned short *)(vc->vc_origin + offset);
else if (!vc->vc_sw->con_screen_pos)
@@ -616,6 +621,218 @@ static void vc_uniscr_debug_check(struct vc_data *vc)
}
}
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static void con_update_softback(struct vc_data *vc)
+{
+ int l = vc->vc_softback_size / vc->vc_size_row;
+ if (l > 5)
+ {
+ vc->vc_softback_end = vc->vc_softback_buf + l * vc->vc_size_row;
+ vc->vc_softback_top = vc->vc_softback_buf;
+ }
+ else
+ /* Smaller scrollback makes no sense, and 0 would screw
+ the operation totally */
+ vc->vc_softback_top = 0;
+}
+
+static int concon_set_origin(struct vc_data *vc)
+{
+ if (vc->vc_softback_lines)
+ concon_scrolldelta(vc, vc->vc_softback_lines);
+ return 0;
+}
+
+#define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
+
+static void con_redraw_softback(struct vc_data *vc, /* struct display *p, */
+ long delta)
+{
+ int count = vc->vc_rows;
+ unsigned short *d, *s;
+ unsigned long n;
+ int line = 0;
+
+ if (!vc->vc_softback_lines)
+ vc->vc_char_at_pos = scr_readw((u16 *)vc->vc_pos);
+
+ d = (u16 *) vc->vc_softback_curr;
+ if (d == (u16 *) vc->vc_softback_in)
+ d = (u16 *) vc->vc_origin;
+ n = vc->vc_softback_curr + delta * vc->vc_size_row;
+ vc->vc_softback_lines -= delta;
+ if (delta < 0) {
+ if (vc->vc_softback_curr < vc->vc_softback_top
+ && n < vc->vc_softback_buf) {
+ n += vc->vc_softback_end - vc->vc_softback_buf;
+ if (n < vc->vc_softback_top) {
+ vc->vc_softback_lines -=
+ (vc->vc_softback_top - n) / vc->vc_size_row;
+ n = vc->vc_softback_top;
+ }
+ } else if (vc->vc_softback_curr >= vc->vc_softback_top
+ && n < vc->vc_softback_top) {
+ vc->vc_softback_lines -=
+ (vc->vc_softback_top - n) / vc->vc_size_row;
+ n = vc->vc_softback_top;
+ }
+ } else {
+ if (vc->vc_softback_curr > vc->vc_softback_in
+ && n >= vc->vc_softback_end) {
+ n += vc->vc_softback_buf - vc->vc_softback_end;
+ if (n > vc->vc_softback_in) {
+ n = vc->vc_softback_in;
+ vc->vc_softback_lines = 0;
+ }
+ } else if (vc->vc_softback_curr <= vc->vc_softback_in
+ && n > vc->vc_softback_in) {
+ n = vc->vc_softback_in;
+ vc->vc_softback_lines = 0;
+ }
+ }
+ if (n == vc->vc_softback_curr)
+ return;
+ vc->vc_softback_curr = n;
+ /* If we're not scrolled any more, restore the character to the cursor
+ * position */
+ if (!vc->vc_softback_lines)
+ scr_writew(vc->vc_char_at_pos, (u16 *)vc->vc_pos);
+ s = (u16 *) vc->vc_softback_curr;
+ if (s == (u16 *) vc->vc_softback_in)
+ s = (u16 *) vc->vc_origin;
+ while (count--) {
+ unsigned short *start;
+ unsigned short *le;
+ unsigned short c;
+ int x = 0;
+ unsigned short attr = 1;
+
+ start = s;
+ le = advance_row(s, 1);
+ /* Temporarily overwrite the character at the cursor position
+ * with the one we actually want to see on the screen. */
+ if (count == vc->vc_rows - vc->state.y - 1)
+ {
+ c = scr_readw((u16 *)(s + vc->state.x));
+ scr_writew(c, (u16 *)vc->vc_pos);
+ vc->vc_sw->con_putcs
+ (vc, (u16 *)vc->vc_pos, 1, line, vc->state.x);
+ }
+ do {
+ c = scr_readw(s);
+ if (attr != (c & 0xff00)) {
+ attr = c & 0xff00;
+ if (s > start) {
+ vc->vc_sw->con_putcs(
+ vc, start, s - start,
+ line, x);
+ x += s - start;
+ start = s;
+ }
+ }
+ if (c == scr_readw(d)) {
+ if (s > start) {
+ vc->vc_sw->con_putcs(
+ vc, start, s - start,
+ line, x);
+ x += s - start + 1;
+ start = s + 1;
+ } else {
+ x++;
+ start++;
+ }
+ }
+ s++;
+ d++;
+ } while (s < le);
+ if (s > start)
+ vc->vc_sw->con_putcs(vc, start, s - start, line, x);
+ line++;
+ if (d == (u16 *) vc->vc_softback_end)
+ d = (u16 *) vc->vc_softback_buf;
+ if (d == (u16 *) vc->vc_softback_in)
+ d = (u16 *) vc->vc_origin;
+ if (s == (u16 *) vc->vc_softback_end)
+ s = (u16 *) vc->vc_softback_buf;
+ if (s == (u16 *) vc->vc_softback_in)
+ s = (u16 *) vc->vc_origin;
+ }
+}
+
+static inline void con_softback_note(struct vc_data *vc, int t,
+ int count)
+{
+ unsigned short *p;
+
+ if (vc->vc_num != fg_console)
+ return;
+ p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row);
+
+ while (count) {
+ scr_memcpyw((u16 *) vc->vc_softback_in, p, vc->vc_size_row);
+ count--;
+ p = advance_row(p, 1);
+ vc->vc_softback_in += vc->vc_size_row;
+ if (vc->vc_softback_in == vc->vc_softback_end)
+ vc->vc_softback_in = vc->vc_softback_buf;
+ if (vc->vc_softback_in == vc->vc_softback_top) {
+ vc->vc_softback_top += vc->vc_size_row;
+ if (vc->vc_softback_top == vc->vc_softback_end)
+ vc->vc_softback_top = vc->vc_softback_buf;
+ }
+ }
+ vc->vc_softback_curr = vc->vc_softback_in;
+}
+
+void concon_scrolldelta(struct vc_data *vc, int lines)
+{
+ /* struct display *disp = &fb_display[fg_console]; */
+ /* int offset, limit, scrollback_old; */
+
+ if (vc->vc_softback_top) {
+ if (vc->vc_num != fg_console)
+ return;
+ if (vc->vc_mode != KD_TEXT || !lines)
+ return;
+#if 0
+ if (logo_shown >= 0) {
+ struct vc_data *conp2 = vc_cons[logo_shown].d;
+
+ if (conp2->vc_top == logo_lines
+ && conp2->vc_bottom == conp2->vc_rows)
+ conp2->vc_top = 0;
+ if (logo_shown == vc->vc_num) {
+ unsigned long p, q;
+ int i;
+
+ p = vc->vc_softback_in;
+ q = vc->vc_origin +
+ logo_lines * vc->vc_size_row;
+ for (i = 0; i < logo_lines; i++) {
+ if (p == vc->vc_softback_top)
+ break;
+ if (p == vc->vc_softback_buf)
+ p = vc->vc_softback_end;
+ p -= vc->vc_size_row;
+ q -= vc->vc_size_row;
+ scr_memcpyw((u16 *) q, (u16 *) p,
+ vc->vc_size_row);
+ }
+ vc->vc_softback_in = vc->vc_softback_curr = p;
+ update_region(vc, vc->vc_origin,
+ logo_lines * vc->vc_cols);
+ }
+ logo_shown = FBCON_LOGO_CANSHOW;
+ }
+#endif
+ vc->vc_sw->con_cursor(vc, CM_ERASE /* | CM_SOFTBACK */);
+ con_redraw_softback(vc, /* disp, */ lines);
+ if (!vc->vc_softback_lines)
+ vc->vc_sw->con_cursor(vc, CM_DRAW /* | CM_SOFTBACK */);
+ }
+}
+
+#endif /* CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK */
static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
enum con_scroll dir, unsigned int nr)
@@ -626,6 +843,10 @@ static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
nr = b - t - 1;
if (b > vc->vc_rows || t >= b || nr < 1)
return;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ if (dir == SM_UP && vc->vc_softback_top)
+ con_softback_note (vc, t, nr);
+#endif
vc_uniscr_scroll(vc, t, b, dir, nr);
if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr))
return;
@@ -641,6 +862,56 @@ static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b,
scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr);
}
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+static void do_update_region(struct vc_data *vc, unsigned long start, int count)
+{
+ unsigned int xx, yy, offset;
+ u16 *p;
+
+ unsigned long origin =
+ (start >= vc->vc_softback_buf && start < vc->vc_softback_end)
+ ? start >= vc->vc_softback_curr
+ ? vc->vc_softback_curr
+ : vc->vc_softback_curr
+ - (vc->vc_softback_end - vc->vc_softback_buf)
+ : vc->vc_origin;
+ p = (u16 *) start;
+ offset = (start - origin) / 2;
+ xx = offset % vc->vc_cols;
+ yy = offset / vc->vc_cols;
+ for(;;) {
+ u16 attrib = scr_readw(p) & 0xff00;
+ int startx = xx;
+ u16 *q = p;
+ while (xx < vc->vc_cols && count) {
+ if (attrib != (scr_readw(p) & 0xff00)) {
+ if (p > q)
+ vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
+ startx = xx;
+ q = p;
+ attrib = scr_readw(p) & 0xff00;
+ }
+ p++;
+ xx++;
+ count--;
+ }
+ if (p > q)
+ vc->vc_sw->con_putcs(vc, q, p-q, yy, startx);
+ if (p == (u16 *) vc->vc_softback_end)
+ p = (u16 *)vc->vc_softback_buf;
+ if (p == (u16 *) vc->vc_softback_in)
+ p = (u16 *)vc->vc_origin;
+ if (!count)
+ break;
+ xx = 0;
+ yy++;
+ /* if (vc->vc_sw->con_getxy) { */
+ /* p = (u16 *)start; */
+ /* start = vc->vc_sw->con_getxy(vc, start, NULL, NULL); */
+ /* } */
+ }
+}
+#else
static void do_update_region(struct vc_data *vc, unsigned long start, int count)
{
unsigned int xx, yy, offset;
@@ -684,6 +955,7 @@ static void do_update_region(struct vc_data *vc, unsigned long start, int count)
}
}
}
+#endif
void update_region(struct vc_data *vc, unsigned long start, int count)
{
@@ -692,7 +964,10 @@ void update_region(struct vc_data *vc, unsigned long start, int count)
if (con_should_update(vc)) {
hide_cursor(vc);
do_update_region(vc, start, count);
- set_cursor(vc);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ if (!vc->vc_softback_lines)
+#endif
+ set_cursor(vc);
}
}
@@ -927,8 +1202,17 @@ static void set_origin(struct vc_data *vc)
WARN_CONSOLE_UNLOCKED();
if (!con_is_visible(vc) ||
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ (
+ !concon_set_origin (vc) &&
+ (
+#endif
!vc->vc_sw->con_set_origin ||
- !vc->vc_sw->con_set_origin(vc))
+ !vc->vc_sw->con_set_origin(vc)
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ ))
+#endif
+ )
vc->vc_origin = (unsigned long)vc->vc_screenbuf;
vc->vc_visible_origin = vc->vc_origin;
vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size;
@@ -1004,7 +1288,6 @@ void redraw_screen(struct vc_data *vc, int is_switch)
hide_cursor(old_vc);
if (!con_is_visible(old_vc)) {
save_screen(old_vc);
- set_origin(old_vc);
}
if (tty0dev)
sysfs_notify(&tty0dev->kobj, NULL, "active");
@@ -1017,7 +1300,6 @@ void redraw_screen(struct vc_data *vc, int is_switch)
int update;
int old_was_color = vc->vc_can_do_color;
- set_origin(vc);
update = vc->vc_sw->con_switch(vc);
set_palette(vc);
/*
@@ -1032,9 +1314,19 @@ void redraw_screen(struct vc_data *vc, int is_switch)
}
if (update && vc->vc_mode != KD_GRAPHICS)
- do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
+ do_update_region(vc,
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ vc->vc_softback_lines
+ ? vc->vc_softback_curr
+ :
+#endif
+ vc->vc_origin,
+ vc->vc_screenbuf_size / 2);
}
- set_cursor(vc);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ if (!vc->vc_softback_lines)
+#endif
+ set_cursor(vc);
if (is_switch) {
vt_set_leds_compute_shiftstate();
notify_update(vc);
@@ -1112,12 +1404,28 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
int err;
WARN_CONSOLE_UNLOCKED();
-
if (currcons >= MAX_NR_CONSOLES)
return -ENXIO;
if (vc_cons[currcons].d)
+ {
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ vc = vc_cons[currcons].d;
+ if (!vc->vc_softback_size) {
+ /* vc was partially initialized by __init. */
+ vc->vc_softback_size = console_soft_scrollback_size;
+ vc->vc_softback_buf =
+ (unsigned long)kzalloc(vc->vc_softback_size, GFP_KERNEL);
+ if (vc->vc_softback_buf) {
+ vc->vc_softback_in = vc->vc_softback_top =
+ vc->vc_softback_curr = vc->vc_softback_buf;
+ vc->vc_softback_lines = 0;
+ con_update_softback(vc);
+ }
+ }
+#endif
return 0;
+ }
/* due to the granularity of kmalloc, we waste some memory here */
/* the alloc is done in two steps, to optimize the common situation
@@ -1157,6 +1465,18 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
vcs_make_sysfs(currcons);
atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, ¶m);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ vc->vc_softback_size = console_soft_scrollback_size;
+ err = -ENOMEM;
+ vc->vc_softback_buf =
+ (unsigned long)kzalloc(vc->vc_softback_size, GFP_KERNEL);
+ if (!vc->vc_softback_buf)
+ goto err_free;
+ vc->vc_softback_in = vc->vc_softback_top = vc->vc_softback_curr =
+ vc->vc_softback_buf;
+ vc->vc_softback_lines = 0;
+ con_update_softback(vc);
+#endif
return 0;
err_free:
visual_deinit(vc);
@@ -1629,7 +1949,7 @@ struct rgb { u8 r; u8 g; u8 b; };
static void rgb_from_256(int i, struct rgb *c)
{
- if (i < 8) { /* Standard colours. */
+ if (i < 8) { /* Standard colours. */
c->r = i&1 ? 0xaa : 0x00;
c->g = i&2 ? 0xaa : 0x00;
c->b = i&4 ? 0xaa : 0x00;
@@ -1641,7 +1961,7 @@ static void rgb_from_256(int i, struct rgb *c)
c->r = (i - 16) / 36 * 85 / 2;
c->g = (i - 16) / 6 % 6 * 85 / 2;
c->b = (i - 16) % 6 * 85 / 2;
- } else /* Grayscale ramp. */
+ } else /* Grayscale ramp. */
c->r = c->g = c->b = i * 10 - 2312;
}
@@ -2888,6 +3208,12 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
param.vc = vc;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ /* Undo any soft scrolling - <Alt><Fn> and <Shift><PgUp/Down> do
+ not pass through this function. */
+ concon_set_origin (vc);
+#endif
+
while (!tty->flow.stopped && count) {
int orig = *buf;
buf++;
@@ -3103,7 +3429,11 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
}
if (cnt && con_is_visible(vc))
vc->vc_sw->con_putcs(vc, start, cnt, vc->state.y, start_x);
- set_cursor(vc);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ if (!vc->vc_softback_lines)
+#endif
+ set_cursor(vc);
+
notify_update(vc);
quit:
@@ -3324,7 +3654,11 @@ static void con_flush_chars(struct tty_struct *tty)
/* if we race with con_close(), vt may be null */
console_lock();
vc = tty->driver_data;
- if (vc)
+ if (vc
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ && !vc->vc_softback_lines
+#endif
+ )
set_cursor(vc);
console_unlock();
}
@@ -3345,6 +3679,10 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty)
vc = vc_cons[currcons].d;
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ con_update_softback(vc);
+#endif
+
/* Still being freed */
if (vc->port.tty) {
ret = -ERESTARTSYS;
@@ -3400,7 +3738,7 @@ static void con_cleanup(struct tty_struct *tty)
tty_port_put(&vc->port);
}
-static int default_color = 7; /* white */
+static int default_color = 7; /* white */
static int default_italic_color = 2; // green (ASCII)
static int default_underline_color = 3; // cyan (ASCII)
module_param_named(color, default_color, int, S_IRUGO | S_IWUSR);
@@ -4100,7 +4438,7 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
con_driver->desc = desc;
con_driver->node = i;
con_driver->flag = CON_DRIVER_FLAG_MODULE |
- CON_DRIVER_FLAG_INIT;
+ CON_DRIVER_FLAG_INIT;
con_driver->first = first;
con_driver->last = last;
retval = 0;
@@ -4401,7 +4739,10 @@ void do_unblank_screen(int leaving_gfx)
if (console_blank_hook)
console_blank_hook(0);
set_palette(vc);
- set_cursor(vc);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ if (!vc->vc_softback_lines)
+#endif
+ set_cursor(vc);
vt_event_post(VT_EVENT_UNBLANK, vc->vc_num, vc->vc_num);
}
EXPORT_SYMBOL(do_unblank_screen);
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 840d9813b0bc..d126d6a4f2b2 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -78,6 +78,55 @@ config FRAMEBUFFER_CONSOLE
help
Low-level framebuffer-based console driver.
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ bool "Enable Scrollback Buffer in System RAM"
+ depends on FB=y && FRAMEBUFFER_CONSOLE
+ default y
+ select FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
+ help
+ This option creates scrollback buffers for each framebuffer console,
+ or one buffer for them all. These buffers are allocated dynamically
+ during initialisation.
+
+ If you want this feature, say 'Y' here and enter the amount of
+ RAM to allocate for this buffer. If unsure, say 'N'.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_SIZE
+ int "Scrollback Buffer Size (in KB)"
+ depends on FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ range 1 1024
+ default "128"
+ help
+ Enter the amount of System RAM to allocate for each scrollback
+ buffer of framebuffer consoles in kilobytes. Each character
+ position on the video takes 2 bytes of storage. 128k will give you
+ approximately 4 240x67 screenfuls of scrollback buffer.
+
+config FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT
+ bool "Persistent Scrollback History for each framebuffer console by default"
+ depends on FB=y && FRAMEBUFFER_CONSOLE && FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ default y
+ help
+
+ Note: this option's value N has not (?yet) been implemented (2021-04).
+
+ Say Y here if the scrollback history should persist by default when
+ switching between consoles. Otherwise, the scrollback history will
+ be flushed the first time a scroll-up operation occurs on the new
+ console after the console is switched. STOUGH!!! FIXME!!! This
+ feature can also be enabled using the boot command line parameter
+ 'vgacon.scrollback_persistent=1'.
+
+ This feature might break your tool of choice to flush the scrollback
+ buffer, e.g. clear(1) will work fine but Debian's clear_console(1)
+ will be broken, which might cause security issues.
+ You can use the escape sequence \e[3J instead if this feature is
+ activated.
+
+ Note that a buffer of VGACON_SOFT_SCROLLBACK_SIZE is taken for each
+ created tty device.
+ So if you use a RAM-constrained system, say N here.
+
config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
bool "Map the console to the primary display device"
depends on FRAMEBUFFER_CONSOLE
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 22bb3892f6bd..c89cc8c605fc 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3053,6 +3053,9 @@ static const struct consw fb_con = {
.con_font_get = fbcon_get_font,
.con_font_default = fbcon_set_def_font,
.con_set_palette = fbcon_set_palette,
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ .con_scrolldelta = concon_scrolldelta,
+#endif
.con_invert_region = fbcon_invert_region,
.con_screen_pos = fbcon_screen_pos,
.con_getxy = fbcon_getxy,
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index d5b9c8d40c18..acc277e73e32 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -110,6 +110,17 @@ struct vc_data {
unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */
unsigned int vc_screenbuf_size;
unsigned char vc_mode; /* KD_TEXT, ... */
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+ unsigned int vc_softback_size; /* Size in bytes of scrollback buffer. */
+ unsigned long vc_softback_buf; /* Address of scrollback buffer. */
+ unsigned long vc_softback_end; /* (Just past) end of buffer. */
+ unsigned long vc_softback_in; /* Head pointer into circular buffer. */
+ unsigned long vc_softback_top; /* Tail pointer into circular buffer. */
+ unsigned long vc_softback_curr; /* Pos in vc_screenbuf or vc_softback_buf
+ corresponding to visible screen. */
+ int vc_softback_lines; /* Number of lines currently scrolled. */
+ unsigned short vc_char_at_pos; /* Char at vc_pos when no soft scroll */
+#endif
/* attributes for all characters on screen */
unsigned char vc_attr; /* Current attributes */
unsigned char vc_def_color; /* Default colors */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 0da94a6dee15..63b83ffbef95 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -115,6 +115,9 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
/* vt.c */
void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
int vt_waitactive(int n);
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_SOFT_SCROLLBACK
+void concon_scrolldelta(struct vc_data *vc, int lines);
+#endif
void change_console(struct vc_data *new_vc);
void reset_vc(struct vc_data *vc);
int do_unbind_con_driver(const struct consw *csw, int first, int last,
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-24 17:29 ` Alan Mackenzie
@ 2021-09-24 23:44 ` Jorge Almeida
2021-09-26 12:36 ` Alan Mackenzie
2021-10-03 11:53 ` Jorge Almeida
2021-09-25 10:14 ` Peter Humphrey
1 sibling, 2 replies; 16+ messages in thread
From: Jorge Almeida @ 2021-09-24 23:44 UTC (permalink / raw
To: gentoo-user
On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie <acm@muc.de> wrote:
>
Hejjo, Alan
> > $ patch -p0 <../patch_for_5.14.diff
> > patching file ./drivers/tty/vt/vt.c
> > Hunk #1 FAILED at 3208.
> > 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
>
> attached. Please start again from a gentoo-sources without any previous
> traces of the scrollback patches, and apply that patch. _Surely_ it
> should work this time.
>
Sure enough, the patch was succesful. Unfortunately, I cannot test it,
because my computer is out of luck (big thunderstorm, crappy power
provider, not-so-smart owner). I can ssh into it and it all seems
fine, but VT's other than tty1 go dim after 1 or 2 seconds (showing
the greeting) and then go black; I can login blindly!
I'm sure it has nothing to do with the patch, since I also booted the
former kernel (for which the previous patch has been applied with
success as expected) and it happens the same. Damaged UPS or MO,
maybe...
Anyway, I'll try again when I manage to fix or replace the computer
and I'll report then.
Thanks,
Jorge Almeida
P.S. I just noticed you mention gentoo-sources. I use the vanilla
kernel from kernel.org. Could that be a problem?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-24 17:29 ` Alan Mackenzie
2021-09-24 23:44 ` Jorge Almeida
@ 2021-09-25 10:14 ` Peter Humphrey
1 sibling, 0 replies; 16+ messages in thread
From: Peter Humphrey @ 2021-09-25 10:14 UTC (permalink / raw
To: gentoo-user
On Friday, 24 September 2021 18:29:11 BST Alan Mackenzie wrote:
> To apply the patch (you surely know this already), cd to the top of the
> kernel tree, and use
>
> $ patch -p1 < 5.14.5-scroll-20210924.diff
[...]
> .. Please let me know again how it works out. Thanks!
Works for me, Alan, against 5.14.7. Once I spotted the change to -p1, that is.
:(
Thanks again.
--
Regards,
Peter.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-24 23:44 ` Jorge Almeida
@ 2021-09-26 12:36 ` Alan Mackenzie
2021-09-26 17:24 ` antlists
2021-10-03 11:53 ` Jorge Almeida
1 sibling, 1 reply; 16+ messages in thread
From: Alan Mackenzie @ 2021-09-26 12:36 UTC (permalink / raw
To: gentoo-user
Hello, Jorge.
On Fri, Sep 24, 2021 at 23:44:51 +0000, Jorge Almeida wrote:
> On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie <acm@muc.de> wrote:
> Hello, Alan
> > > $ patch -p0 <../patch_for_5.14.diff
> > > patching file ./drivers/tty/vt/vt.c
> > > Hunk #1 FAILED at 3208.
> > > 1 out of 1 hunk FAILED -- saving rejects to file ./drivers/tty/vt/vt.c.rej
> > attached. Please start again from a gentoo-sources without any previous
> > traces of the scrollback patches, and apply that patch. _Surely_ it
> > should work this time.
> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
> because my computer is out of luck (big thunderstorm, crappy power
> provider, not-so-smart owner).
I'm sorry to hear it. I'm sure you've done it already, but get a decent
backup from that machine somehow while it is still even partly working.
> I can ssh into it and it all seems fine, but VT's other than tty1 go
> dim after 1 or 2 seconds (showing the greeting) and then go black; I
> can login blindly! I'm sure it has nothing to do with the patch,
> since I also booted the former kernel (for which the previous patch
> has been applied with success as expected) and it happens the same.
> Damaged UPS or MO, maybe... Anyway, I'll try again when I manage to
> fix or replace the computer and I'll report then.
OK, thanks!
> Thanks,
> Jorge Almeida
> P.S. I just noticed you mention gentoo-sources. I use the vanilla
> kernel from kernel.org. Could that be a problem?
Highly unlikely. I doubt very much there's any difference in the tty
code between vanilla and gentoo-sources, but even so, I'm now basing my
patches on a Linux repository cloned from their central repository
server.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 12:36 ` Alan Mackenzie
@ 2021-09-26 17:24 ` antlists
2021-09-26 18:00 ` Dale
2021-09-26 21:22 ` Jorge Almeida
0 siblings, 2 replies; 16+ messages in thread
From: antlists @ 2021-09-26 17:24 UTC (permalink / raw
To: gentoo-user
On 26/09/2021 13:36, Alan Mackenzie wrote:
>> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
>> because my computer is out of luck (big thunderstorm, crappy power
>> provider, not-so-smart owner).
> I'm sorry to hear it. I'm sure you've done it already, but get a decent
> backup from that machine somehow while it is still even partly working.
>
Sounds like the drive is fine, but of course the question is "for how
long? ..."
When you rebuild it, get a surge protector and then put a UPS behind
that ... snag is that's all extra expense :-(
Cheers,
Wol
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 17:24 ` antlists
@ 2021-09-26 18:00 ` Dale
2021-09-26 21:22 ` Jorge Almeida
1 sibling, 0 replies; 16+ messages in thread
From: Dale @ 2021-09-26 18:00 UTC (permalink / raw
To: gentoo-user
antlists wrote:
> On 26/09/2021 13:36, Alan Mackenzie wrote:
>>> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
>>> because my computer is out of luck (big thunderstorm, crappy power
>>> provider, not-so-smart owner).
>
>> I'm sorry to hear it. I'm sure you've done it already, but get a decent
>> backup from that machine somehow while it is still even partly working.
>>
> Sounds like the drive is fine, but of course the question is "for how
> long? ..."
>
> When you rebuild it, get a surge protector and then put a UPS behind
> that ... snag is that's all extra expense :-(
>
> Cheers,
> Wol
>
>
I agree with that advise. When I built my first system, I bought a UPS
a couple months later. While most UPS's have a lot of surge protection
built in, I do have additional surge protection at the wall plug and I
also have a whole house surge protector in the breaker box as well. I
make sure the light is green often, mostly check after a bad storm.
Having protection against momentary drops in either voltage or just a
outright outage for a few seconds or longer gives a lot of protection.
File systems like to be unmounted and power failures are not good. Most
file systems are good at recovering from problems but it does have risk.
After buying a UPS and other protections, I've had very few problems
that come from power issues. The biggest problem I have is the
batteries in the UPS going bad and me not knowing it, even tho the UPS
is supposed to alert me of that. Most computer power supplies can
handle a lot but having that protection outside the computer is best.
Often, it is cheaper than a computer too.
If I had to pick one thing to protect my computer, it would be a UPS.
It protects from most all the problems a computer can have with power.
Protects against surges, brownouts and complete loss of power.
Additional protection adds more protection but a UPS is a really good
start. Even a small one that can only run a few minutes offers a lot.
Just something to think on.
Dale
:-) :-)
P. S. I have a CyberPower UPS. There are a lot of good brands out
there tho.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 17:24 ` antlists
2021-09-26 18:00 ` Dale
@ 2021-09-26 21:22 ` Jorge Almeida
2021-09-26 22:17 ` Wols Lists
2021-09-26 23:51 ` Dale
1 sibling, 2 replies; 16+ messages in thread
From: Jorge Almeida @ 2021-09-26 21:22 UTC (permalink / raw
To: gentoo-user
On Sun, Sep 26, 2021 at 6:24 PM antlists <antlists@youngman.org.uk> wrote:
>
Hello, Wol and Dale
> When you rebuild it, get a surge protector and then put a UPS behind
> that ... snag is that's all extra expense :-(
>
Surge protectors: I googled it and mostly got bad reviews. Do they
_really_work? What would you recommend? It probably should be
something amazon-purchasable! Availability in my country is probably
limited (and overpriced to boot, I bet).
UPS: never gave it serious thought, I had the impression there was too
much unclear stuff: for example, is it noisy (does it need a fan)? If
(when) some component needs replacement will I know it before
disaster? And does the replacement require a "qualified technician"? (
Dale's description is not very reassuring!)
Note that my lightning problem happened at night with both computer
and monitor powered down (but still connected to a wall outlet through
an interrupted extension; hence the "not-so-smart" self-qualifying...)
Thanks for your suggestions
Jorge
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 21:22 ` Jorge Almeida
@ 2021-09-26 22:17 ` Wols Lists
2021-09-26 23:51 ` Dale
1 sibling, 0 replies; 16+ messages in thread
From: Wols Lists @ 2021-09-26 22:17 UTC (permalink / raw
To: gentoo-user
On 26/09/2021 22:22, Jorge Almeida wrote:
> On Sun, Sep 26, 2021 at 6:24 PM antlists <antlists@youngman.org.uk> wrote:
>>
> Hello, Wol and Dale
>> When you rebuild it, get a surge protector and then put a UPS behind
>> that ... snag is that's all extra expense :-(
>>
>
> Surge protectors: I googled it and mostly got bad reviews. Do they
> _really_work? What would you recommend? It probably should be
> something amazon-purchasable! Availability in my country is probably
> limited (and overpriced to boot, I bet).
Surge protectors are tricky. In the UK, our power supply is pretty clean
so they're (almost) a waste of time. They should have a status on them,
usually they're good for one shock and that's it. The big danger in many
places is a lightning hit on overhead power lines. And if it's a storm
you can have several hits in quick succession which will overwhelm the
protector ...
>
> UPS: never gave it serious thought, I had the impression there was too
> much unclear stuff: for example, is it noisy (does it need a fan)? If
> (when) some component needs replacement will I know it before
> disaster? And does the replacement require a "qualified technician"? (
> Dale's description is not very reassuring!)
Again, you need a decent unit. And they're mostly a lot cheaper than a
computer, so if they take the hit rather than your computer you're quids
in whatever. But even if they're a not-very-good unit, if your local
power is crappy they should clean it up and protect your computer to
some extent.
>
> Note that my lightning problem happened at night with both computer
> and monitor powered down (but still connected to a wall outlet through
> an interrupted extension; hence the "not-so-smart" self-qualifying...)
>
The problem is, I'm in an area where the protection these things provide
is pretty redundant - I'd probably be fine without them. If you need
them, as I said the danger is they're overwhelmed right at the start and
then your kit gets damaged along with the surge protector and UPS ...
Cheers.
Wol
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 21:22 ` Jorge Almeida
2021-09-26 22:17 ` Wols Lists
@ 2021-09-26 23:51 ` Dale
2021-09-27 15:42 ` Jorge Almeida
1 sibling, 1 reply; 16+ messages in thread
From: Dale @ 2021-09-26 23:51 UTC (permalink / raw
To: gentoo-user
Jorge Almeida wrote:
> On Sun, Sep 26, 2021 at 6:24 PM antlists <antlists@youngman.org.uk> wrote:
> Hello, Wol and Dale
>> When you rebuild it, get a surge protector and then put a UPS behind
>> that ... snag is that's all extra expense :-(
>>
> Surge protectors: I googled it and mostly got bad reviews. Do they
> _really_work? What would you recommend? It probably should be
> something amazon-purchasable! Availability in my country is probably
> limited (and overpriced to boot, I bet).
>
> UPS: never gave it serious thought, I had the impression there was too
> much unclear stuff: for example, is it noisy (does it need a fan)? If
> (when) some component needs replacement will I know it before
> disaster? And does the replacement require a "qualified technician"? (
> Dale's description is not very reassuring!)
>
> Note that my lightning problem happened at night with both computer
> and monitor powered down (but still connected to a wall outlet through
> an interrupted extension; hence the "not-so-smart" self-qualifying...)
>
> Thanks for your suggestions
>
> Jorge
>
>
I had lightening strike right down the road, about 1,000 feet as a bird
flies. It took out some stuff at my neighbors, including a freezer
which died a month later. It even blew light bulbs, I mean literally
blew them. They exploded and glass went all over the room. I suggested
surge protection for their computer, TV and such a while before that.
Even with a virtually direct hit, the surge protectors kept working.
Not long after that, they wanted a UPS for their computer but also
wanted one for the TV, since the dish box takes a while to reload after
the power blinks. So I helped them pick a fair sized UPS for the puter
and a smaller one for the TV. The puter runs long enough to shutdown
normally and the TV is protected for those little blinks in power that
last just long enough to reset everything.
One way to pick a decent surge device, look at the warranty. If it
includes paying for items plugged in, then you're off to a good start at
least. I just try to get as high a joule rating as I can. The reason
for that, they can absorb more than one hit and still protect. While
one large hit can disable protection, it can take out hundreds of
smaller hits and still work. It all comes down to the quality of the
MOVs and the design of the protector.
If you use Amazon: APC, Belkin and Tripp Lite are some brands I've heard
or seen are good. I've used a couple of those brands myself. I've
always heard that the Monster brand is also good but a bit pricey. When
I researched them long ago, they are some heavy duty built products so
if a person has some serious power problems, they may be well worth the
expense. I bought some on ebay that were Etekcity brand but it seems
they no longer make them. I bought some that had a little over 5,000
joules of protection. The only thing I didn't like, if power fails, it
stays off. It doesn't have a hardware switch but a circuit switch that
resets on power loss. That can be a good thing in some situations but I
don't like it. They are good protectors tho.
Hope that info helps. Also hope you can find something to prevent
future problems.
Dale
:-) :-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-26 23:51 ` Dale
@ 2021-09-27 15:42 ` Jorge Almeida
0 siblings, 0 replies; 16+ messages in thread
From: Jorge Almeida @ 2021-09-27 15:42 UTC (permalink / raw
To: gentoo-user
On Mon, Sep 27, 2021 at 12:51 AM Dale <rdalek1967@gmail.com> wrote:
>
> Jorge Almeida wrote:
> > On Sun, Sep 26, 2021 at 6:24 PM antlists <antlists@youngman.org.uk> wrote:
> > Hello, Wol and Dale
> >> When you rebuild it, get a surge protector and then put a UPS behind
> >> that ... snag is that's all extra expense :-(
> >>
> Hope that info helps. Also hope you can find something to prevent
> future problems.
>
Thanks, Dale and Wol. I'll give it some thought. First thing is to
replace the PSU and see how it goes. I may ask for your opinions
before buying UPS & surge protector when I'll have it sorted out.
Jorge
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [gentoo-user] console scrollback (kernel 5.14)
2021-09-24 23:44 ` Jorge Almeida
2021-09-26 12:36 ` Alan Mackenzie
@ 2021-10-03 11:53 ` Jorge Almeida
1 sibling, 0 replies; 16+ messages in thread
From: Jorge Almeida @ 2021-10-03 11:53 UTC (permalink / raw
To: gentoo-user
On Sat, Sep 25, 2021 at 12:44 AM Jorge Almeida <jjalmeida@gmail.com> wrote:
>
> On Fri, Sep 24, 2021 at 5:29 PM Alan Mackenzie <acm@muc.de> wrote:
> >
>
> > attached. Please start again from a gentoo-sources without any previous
> > traces of the scrollback patches, and apply that patch. _Surely_ it
> > should work this time.
> >
> Sure enough, the patch was succesful. Unfortunately, I cannot test it,
>
> Anyway, I'll try again when I manage to fix or replace the computer
> and I'll report then.
>
OK, the patch is working for me, kernel 5.14.4 (not the same
computer---RIP the other one---, but same hard disk)
Thanks
Jorge Almeida
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-10-03 11:54 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-18 20:40 [gentoo-user] console scrollback (kernel 5.14) Jorge Almeida
2021-09-22 20:28 ` Alan Mackenzie
2021-09-22 21:40 ` Jorge Almeida
2021-09-23 18:03 ` Alan Mackenzie
2021-09-24 8:22 ` Jorge Almeida
2021-09-24 17:29 ` Alan Mackenzie
2021-09-24 23:44 ` Jorge Almeida
2021-09-26 12:36 ` Alan Mackenzie
2021-09-26 17:24 ` antlists
2021-09-26 18:00 ` Dale
2021-09-26 21:22 ` Jorge Almeida
2021-09-26 22:17 ` Wols Lists
2021-09-26 23:51 ` Dale
2021-09-27 15:42 ` Jorge Almeida
2021-10-03 11:53 ` Jorge Almeida
2021-09-25 10:14 ` Peter Humphrey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox