Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

User hostile.


devel / comp.arch / Interrupts on the Concertina II

SubjectAuthor
* Interrupts on the Concertina IIQuadibloc
+* Re: Interrupts on the Concertina IIScott Lurndal
|`- Re: Interrupts on the Concertina IIDavid Brown
+* Re: Interrupts on the Concertina IIEricP
|+* Re: Interrupts on the Concertina IIMitchAlsup1
||+- Re: Interrupts on the Concertina IIScott Lurndal
||`- Re: Interrupts on the Concertina IIEricP
|+* Re: Interrupts on the Concertina IIQuadibloc
||`* Re: Interrupts on the Concertina IIEricP
|| `* Re: Interrupts on the Concertina IIMitchAlsup1
||  `- Re: Interrupts on the Concertina IIEricP
|`* Re: Interrupts on the Concertina IIQuadibloc
| +* Re: Interrupts on the Concertina IIBGB
| |`* Re: Interrupts on the Concertina IIMitchAlsup1
| | +- Re: Interrupts on the Concertina IIScott Lurndal
| | `* Re: Interrupts on the Concertina IIBGB
| |  `* Re: Interrupts on the Concertina IIMitchAlsup1
| |   +- Re: Interrupts on the Concertina IIBGB
| |   `* Re: Interrupts on the Concertina IIScott Lurndal
| |    +* Re: Interrupts on the Concertina IIMitchAlsup1
| |    |`* Re: Interrupts on the Concertina IIScott Lurndal
| |    | `* Re: Interrupts on the Concertina IIMitchAlsup1
| |    |  `- Re: Interrupts on the Concertina IIScott Lurndal
| |    `* Re: Interrupts on the Concertina IIBGB
| |     +* Re: Interrupts on the Concertina IIMitchAlsup1
| |     |+* Re: Interrupts on the Concertina IIBGB-Alt
| |     ||`- Re: Interrupts on the Concertina IIChris M. Thomasson
| |     |`* Re: Interrupts on the Concertina IIEricP
| |     | `* Re: Interrupts on the Concertina IIMitchAlsup1
| |     |  `* Re: Interrupts on the Concertina IIEricP
| |     |   `* Re: Interrupts on the Concertina IIMitchAlsup1
| |     |    `* Re: Page tables and TLBs [was Interrupts on the Concertina II]EricP
| |     |     `* Re: Page tables and TLBs [was Interrupts on the Concertina II]MitchAlsup1
| |     |      `* Re: Page tables and TLBs [was Interrupts on the Concertina II]EricP
| |     |       `* Re: Page tables and TLBs [was Interrupts on the Concertina II]MitchAlsup1
| |     |        `* Re: Page tables and TLBs [was Interrupts on the Concertina II]EricP
| |     |         `- Re: Page tables and TLBs [was Interrupts on the Concertina II]MitchAlsup1
| |     `- Re: Interrupts on the Concertina IIScott Lurndal
| `- Re: Interrupts on the Concertina IIMitchAlsup1
`* Re: Interrupts on the Concertina IIMitchAlsup1
 `* Re: Interrupts on the Concertina IIChris M. Thomasson
  `* Re: Interrupts on the Concertina IIMitchAlsup1
   +* Re: Interrupts on the Concertina IIChris M. Thomasson
   |+- Re: Interrupts on the Concertina IIChris M. Thomasson
   |`- Re: Interrupts on the Concertina IIMitchAlsup1
   `* Re: Interrupts on the Concertina IIEricP
    +- Re: Interrupts on the Concertina IIChris M. Thomasson
    `* Re: Interrupts on the Concertina IIMitchAlsup1
     +- Re: Interrupts on the Concertina IIChris M. Thomasson
     +* Re: Interrupts on the Concertina IIChris M. Thomasson
     |`* Re: Interrupts on the Concertina IIMitchAlsup1
     | `* Re: Interrupts on the Concertina IIChris M. Thomasson
     |  `* Re: Interrupts on the Concertina IIChris M. Thomasson
     |   `- Re: Interrupts on the Concertina IIChris M. Thomasson
     `* Re: Interrupts on the Concertina IIEricP
      +- Re: Interrupts on the Concertina IIMitchAlsup1
      `- Re: Interrupts on the Concertina IIChris M. Thomasson

Pages:123
Interrupts on the Concertina II

<uo930v$24cq0$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36893&group=comp.arch#36893

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: quadibloc@servername.invalid (Quadibloc)
Newsgroups: comp.arch
Subject: Interrupts on the Concertina II
Date: Wed, 17 Jan 2024 17:33:19 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <uo930v$24cq0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 17 Jan 2024 17:33:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="895617081c74407e080c78877190b308";
logging-data="2241344"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GCCVnn0Euq8pI9fbx5FAjQD+ZIxzHahY="
User-Agent: Pan/0.146 (Hic habitat felicitas; d7a48b4
gitlab.gnome.org/GNOME/pan.git)
Cancel-Lock: sha1:7I1glLVEW1RLwYrkDT/KjRkgve8=
 by: Quadibloc - Wed, 17 Jan 2024 17:33 UTC

When a computer recieves an interrupt signal, it needs to save
the complete machine state, so that upon return from the
interrupt, the program thus interrupted is in no way affected.

This is because interrupts can happen at any time, and thus
programs don't prepare for them or expect them. Any disturbance
to the contents of any register would risk causing programs to
crash.

The Concertina II has a potentially large machine state which most
programs do not use. There are vector registers, of the huge
kind found in the Cray I. There are banks of 128 registers to
supplement the banks of 32 registers.

One obvious step in addressing this is for programs that don't
use these registers to run without access to those registers.
If this is indicated in the PSW, then the interrupt routine will
know what it needs to save and restore.

A more elaborate and more automated method is also possible.

Let us imagine the computer speeds up interrupts by having a
second bank of registers that interrupt routines use. But two
register banks aren't enough, as many user programs are running
concurrently.

Here is how I envisage the sequence of events in response to
an interrupt could work:

1) The computer, at the beginning of an area of memory
sufficient to hold all the contents of the computer's
registers, including the PSW and program counter, places
a _restore status_.

2) The computer switches to the interrupt register bank,
and places a pointer to the restore status in one of the
registers, according to a known convention.

3) As the interrupt service routine runs, the computer,
separately and in the background, saves the registers of the
interrupted program into memory. Once this is complete, the
_restore status_ value in memory is changed to reflect this.

4) The restore status value has _two_ uses.

One is, obviously, that when returning from an interrupt,
there will be a 'return from interrupt' routine that will
either just switch register banks, if the registers aren't
saved yet, or re-fill the registers that are actually in
use (the register status also indicating what the complement
of registers available to the interrupted program was) from
memory.

The other is that the restore status can be tested. If the
main register set isn't saved yet, then it's too soon after
the interrupt to *switch to another user program* which also
would use the main register set, but with a different set
of saved values.

5) Some other factors complicate this.

There may be multiple sets of user program registers to
facilitate SMT.

The standard practice in an operating system is to leave
the privileged interrupt service routine as quickly as
possible, and continue handling the interrupt in an
unprivileged portion of the operating system. However, the
return from interrupt instruction is obviously privileged,
as it allows one to put an arbitrary value from memory into
the Program Status Word, including one that would place
the computer into a privileged state after the return.

That last is not unique to the Concertina II, however. So
the obvious solution of allowing the kernel to call
unprivileged subroutines - which terminate in a supervisor
call rather than a normal return - has been found.

John Savard

Re: Interrupts on the Concertina II

<PCUpN.237105$xHn7.12585@fx14.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36895&group=comp.arch#36895

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Interrupts on the Concertina II
Newsgroups: comp.arch
References: <uo930v$24cq0$1@dont-email.me>
Lines: 54
Message-ID: <PCUpN.237105$xHn7.12585@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 17 Jan 2024 18:02:23 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 17 Jan 2024 18:02:23 GMT
X-Received-Bytes: 2737
 by: Scott Lurndal - Wed, 17 Jan 2024 18:02 UTC

Quadibloc <quadibloc@servername.invalid> writes:
>When a computer recieves an interrupt signal, it needs to save
>the complete machine state, so that upon return from the
>interrupt, the program thus interrupted is in no way affected.
>
>This is because interrupts can happen at any time, and thus
>programs don't prepare for them or expect them. Any disturbance
>to the contents of any register would risk causing programs to
>crash.

Something needs to preserve state, either the hardware or
the software. Most risc processors lean towards the latter,
generally for good reason - one may not need to save
all the state if the interrupt handler only touchs part of it.

>
>The Concertina II has a potentially large machine state which most
>programs do not use. There are vector registers, of the huge
>kind found in the Cray I. There are banks of 128 registers to
>supplement the banks of 32 registers.
>
>One obvious step in addressing this is for programs that don't
>use these registers to run without access to those registers.
>If this is indicated in the PSW, then the interrupt routine will
>know what it needs to save and restore.

Just like x86 floating point.

>
>A more elaborate and more automated method is also possible.
>
>Let us imagine the computer speeds up interrupts by having a
>second bank of registers that interrupt routines use. But two
>register banks aren't enough, as many user programs are running
>concurrently.
>
>Here is how I envisage the sequence of events in response to
>an interrupt could work:
>
>1) The computer, at the beginning of an area of memory
>sufficient to hold all the contents of the computer's
>registers, including the PSW and program counter, places
>a _restore status_.

Slow DRAM or special SRAMs? The former will add
considerable latency to an interrupt, the later costs
area (on a per-hardware-thread basis) and floorplanning
issues.

Best is to save the minimal amount of state in hardware
and let software deal with the rest, perhaps with
hints from the hardware (e.g. a bit that indicates
whether the FPRs were modified since the last context
switch, etc).

Re: Interrupts on the Concertina II

<xTWpN.140322$yEgf.868@fx09.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36902&group=comp.arch#36902

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!nntp.comgw.net!weretis.net!feeder6.news.weretis.net!news.cmpublishers.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
From: ThatWouldBeTelling@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
References: <uo930v$24cq0$1@dont-email.me>
In-Reply-To: <uo930v$24cq0$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 52
Message-ID: <xTWpN.140322$yEgf.868@fx09.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Wed, 17 Jan 2024 20:36:45 UTC
Date: Wed, 17 Jan 2024 15:35:56 -0500
X-Received-Bytes: 3077
 by: EricP - Wed, 17 Jan 2024 20:35 UTC

Quadibloc wrote:
> When a computer recieves an interrupt signal, it needs to save
> the complete machine state, so that upon return from the
> interrupt, the program thus interrupted is in no way affected.

It needs to save the portion of the machine state overwritten by that
interrupt. Often this is a small subset of the whole state because many
interrupts only need a few integer registers, maybe 6 or 7.
Additional integer state will be saved and restored as needed by the call ABI
so does not need to be done for every interrupt by the handler prologue.

This allows the OS to only save and restore the full state on thread
switch which only happens after something significant occurs that
changes the highest priority thread on a particular core.
This occurs much less than the frequency of interrupts.

> This is because interrupts can happen at any time, and thus
> programs don't prepare for them or expect them. Any disturbance
> to the contents of any register would risk causing programs to
> crash.
>
> The Concertina II has a potentially large machine state which most
> programs do not use. There are vector registers, of the huge
> kind found in the Cray I. There are banks of 128 registers to
> supplement the banks of 32 registers.

I have trouble imagining what an interrupt handler might use vectors for.

Some OS's deal with this by specifying that drivers can only use integers.
(Graphics drivers get special dispensation but they run in special context.)

> One obvious step in addressing this is for programs that don't
> use these registers to run without access to those registers.
> If this is indicated in the PSW, then the interrupt routine will
> know what it needs to save and restore.
>
> A more elaborate and more automated method is also possible.
>
> Let us imagine the computer speeds up interrupts by having a
> second bank of registers that interrupt routines use. But two
> register banks aren't enough, as many user programs are running
> concurrently.

A consequence of this approach is that the second bank of interrupt
registers are architecturally visible, which means they tie down
resources like physical registers for all those interrupt registers
even when not in use.

And since there are multiple priority interrupt levels each with a bank,
you quickly wind up with hundreds of physical registers mostly sitting
around doing nothing but tied to other contexts.

Re: Interrupts on the Concertina II

<c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36903&group=comp.arch#36903

  copy link   Newsgroups: comp.arch
Date: Wed, 17 Jan 2024 22:11:46 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$Gg8ZY4u3i3yYSv9Hzp3g6OHRHAhlUSzHH6YM21ecHItISN8p3/vD2
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me>
Organization: Rocksolid Light
Message-ID: <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
 by: MitchAlsup1 - Wed, 17 Jan 2024 22:11 UTC

Quadibloc wrote:

> When a computer recieves an interrupt signal, it needs to save
> the complete machine state, so that upon return from the
> interrupt, the program thus interrupted is in no way affected.

State needs to be saved, whether SW or HW does the save is a free
variable.

> This is because interrupts can happen at any time, and thus
> programs don't prepare for them or expect them. Any disturbance
> to the contents of any register would risk causing programs to
> crash.

Also note:: the ABA problem can happen when an interrupt transpires
in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
before transferring control to the interrupt handler.

> The Concertina II has a potentially large machine state which most
> programs do not use. There are vector registers, of the huge
> kind found in the Cray I. There are banks of 128 registers to
> supplement the banks of 32 registers.

In the past, each register set can be guarded by an in-use bit
and save/restore can be avoided when not in-use.

Then again, My 66000 only has 64 registers, and one reason for this
is to keep context switch times minimal, and the SW path from one
context to the next minimal.

> One obvious step in addressing this is for programs that don't
> use these registers to run without access to those registers.

Or not have them to begin with:: Take Vector Registers:: My 66000
Virtual Vector Method (VVM) enables HW to vectorize a loop with
the property that if an interrupt or exception transpires, the
loop collapses into Scalar mode and the interrupt handler remains
blissfully unaware the the instruction raising the exception is at
a precise point. When control returns the rest of one loop runs in
Scalar mode and when control transfers back to the top of the loop
the loop is re-vectorized. This costs 2 instructions (VEC and LOOP)
and 6-bits of state in PSL

> If this is indicated in the PSW, then the interrupt routine will
> know what it needs to save and restore.

I use PSL instead of PSW because the amount of state is a cache line
not a word, doubleword, or quadword. But space here is at a premium.

> A more elaborate and more automated method is also possible.

> Let us imagine the computer speeds up interrupts by having a
> second bank of registers that interrupt routines use. But two
> register banks aren't enough, as many user programs are running
> concurrently.

You are ignoring several interesting facts with modern interrupt
systems.

a) each GuestOS has its own interrupt table(s) and the Hypervisor
has its own interrupt tables.

b) multiprocessing is a given. There are situations where an interrupt
is sent from a device and a number of cores can respond. The proper
core is the one running at the lowest priority level, and the core
that gets there first.

In My 66000 case, the interrupt is recognized by the core detecting a
write to the raised interrupt register, going out and fetching the
interrupt #. This bus transaction can return "here is the interrupt
#" or it can respond with "someone else already got it". In the later
case, the core goes on doing its current thing. In the former case,
core responds with "I am going to handle this one", and the interrupt
controller acknowledges the interrupt.

Until the interrupt # returns, the core continues processing whatever
it was doing, and then the core goes out and fetches the 5 cache lines
of the interrupt dispatcher thread, as these lines arrive, they displace
the current thread lines. So the restore happens before the save, the
save after the reload, and arriving data pushes out current data.

When control arrives at interrupt dispatcher it has a complete set of
registers (minus 2 used to tell the dispatcher what interrupt it is
to handle.) So, the receiving thread has its SP, its FP, its Root
pointer, its ASID, and for all practical purposes it begins running
as if the first instruction at the dispatcher saw the 30 register
the last instruction performed the last time this thread ran. Thus,
it can hold any variety of pointers to various data structures the
OS deems relevant.

The interrupt dispatcher is 4 instructions long, the first checks
that the interrupt is in bounds, the second directs control out of
if the interrupt is not within bounds, the third transfers control
the the handler (CALL) and when the handler returns control attempts
to return to the interrupted thread.

Many times the handler SoftIRQs (or DPCs) cleanup handlers. The
SuperVisor Return instruction (SVR) checks if there are scheduled
thread above the thread we are attempting to return control to,
and transfers control too them before transferring control to
the interrupted thread. There is no need for SW to sort this out.

> Here is how I envisage the sequence of events in response to
> an interrupt could work:

> 1) The computer, at the beginning of an area of memory
> sufficient to hold all the contents of the computer's
> registers, including the PSW and program counter, places
> a _restore status_.

I found no reason and no rational to assign any of this to
any specific place in memory.

Instead, the entire Supervisor "Stack" is in a set of control
registers, and from those control registers we can find any
thread and all state associated with them.

The Supervisor Stack contains 4 CRs that point at {HV, GuestHV,
GuestOS, Application} a 2-bit "who is currently in charge" a
6-bit priority, an interrupt table pointer, and a dispatcher.
It is (also) 1 cache line long.

> 2) The computer switches to the interrupt register bank,
> and places a pointer to the restore status in one of the
> registers, according to a known convention.

> 3) As the interrupt service routine runs, the computer,
> separately and in the background, saves the registers of the
> interrupted program into memory. Once this is complete, the
> _restore status_ value in memory is changed to reflect this.

> 4) The restore status value has _two_ uses.

> One is, obviously, that when returning from an interrupt,
> there will be a 'return from interrupt' routine that will
> either just switch register banks, if the registers aren't
> saved yet, or re-fill the registers that are actually in
> use (the register status also indicating what the complement
> of registers available to the interrupted program was) from
> memory.

You are going to have a lot of complications with SoftIRQ/DPCs
doing it this way.

> The other is that the restore status can be tested. If the
> main register set isn't saved yet, then it's too soon after
> the interrupt to *switch to another user program* which also
> would use the main register set, but with a different set
> of saved values.

> 5) Some other factors complicate this.

> There may be multiple sets of user program registers to
> facilitate SMT.

> The standard practice in an operating system is to leave
> the privileged interrupt service routine as quickly as
> possible, and continue handling the interrupt in an
> unprivileged portion of the operating system.

This is the SoftIRQs and DPCs.

> However, the
> return from interrupt instruction is obviously privileged,

Why ?? If you are not "in" an interrupt it can raise OPERATION
exception WHITHOUT BEING PRIVILEGEd !! {{Hint: you don't want
a privileged thread to perform a return from interrupt unless
you are IN an interrupt EITHER.}}

> as it allows one to put an arbitrary value from memory into
> the Program Status Word, including one that would place
> the computer into a privileged state after the return.

> That last is not unique to the Concertina II, however. So
> the obvious solution of allowing the kernel to call
> unprivileged subroutines - which terminate in a supervisor
> call rather than a normal return - has been found.

How does privilege get restored on return ??

> John Savard

Re: Interrupts on the Concertina II

<33d5e9b128134f83540aaaa460b6be0a@news.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36904&group=comp.arch#36904

  copy link   Newsgroups: comp.arch
Date: Wed, 17 Jan 2024 22:17:03 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$28K9wdaaSI4t5wZuycanv.V0sHkkvSAc7jNC7PJ/gUFSkt8YZGASG
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad>
Organization: Rocksolid Light
Message-ID: <33d5e9b128134f83540aaaa460b6be0a@news.novabbs.org>
 by: MitchAlsup1 - Wed, 17 Jan 2024 22:17 UTC

EricP wrote:

> Quadibloc wrote:
>> When a computer recieves an interrupt signal, it needs to save
>> the complete machine state, so that upon return from the
>> interrupt, the program thus interrupted is in no way affected.

> It needs to save the portion of the machine state overwritten by that
> interrupt. Often this is a small subset of the whole state because many
> interrupts only need a few integer registers, maybe 6 or 7.

Would an interrupt handler not run fewer instructions if its register
state was seeded with pointers of use to the device(s) being serviced ??

> Additional integer state will be saved and restored as needed by the call ABI
> so does not need to be done for every interrupt by the handler prologue.

> This allows the OS to only save and restore the full state on thread
> switch which only happens after something significant occurs that
> changes the highest priority thread on a particular core.

Doesn't running a SoftIRQ (or DPC) require a full register state ??
And don't most device initerrupts need to SoftIRQ ??
{{Yes, I see timer interrupts not needing so much of that}}

> This occurs much less than the frequency of interrupts.

>> This is because interrupts can happen at any time, and thus
>> programs don't prepare for them or expect them. Any disturbance
>> to the contents of any register would risk causing programs to
>> crash.
>>
>> The Concertina II has a potentially large machine state which most
>> programs do not use. There are vector registers, of the huge
>> kind found in the Cray I. There are banks of 128 registers to
>> supplement the banks of 32 registers.

> I have trouble imagining what an interrupt handler might use vectors for.

Memory to memory move from Disk Cache to User Buffer.
SoftIRQ might use Vector arithmetic to verify CRC, Encryption, ...

> Some OS's deal with this by specifying that drivers can only use integers.
> (Graphics drivers get special dispensation but they run in special context.)

Re: Interrupts on the Concertina II

<uo9pa2$286lv$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36907&group=comp.arch#36907

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Wed, 17 Jan 2024 15:53:37 -0800
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uo9pa2$286lv$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me>
<c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 17 Jan 2024 23:53:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cc6405ddd276c3b4eb7c996db44b0166";
logging-data="2366143"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Sbc2sg3HmmAq/TKBMW+7G17d35Tun1vo="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5uMXAVdeXBKkJ9a7dxgp//GZZ9A=
Content-Language: en-US
In-Reply-To: <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
 by: Chris M. Thomasson - Wed, 17 Jan 2024 23:53 UTC

On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
> Quadibloc wrote:
>
>> When a computer recieves an interrupt signal, it needs to save
>> the complete machine state, so that upon return from the
>> interrupt, the program thus interrupted is in no way affected.
>
> State needs to be saved, whether SW or HW does the save is a free variable.
>
>> This is because interrupts can happen at any time, and thus
>> programs don't prepare for them or expect them. Any disturbance
>> to the contents of any register would risk causing programs to
>> crash.
>
> Also note:: the ABA problem can happen when an interrupt transpires
> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
> before transferring control to the interrupt handler.
[...]

Just to be clear an interrupt occurring within the hardware
implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
should not effect the outcome of the CAS. Actually, it should not happen
at all, right? CAS does not have any spurious failures.

Re: Interrupts on the Concertina II

<5OZpN.70213$CYpe.14489@fx40.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36908&group=comp.arch#36908

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx40.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Interrupts on the Concertina II
Newsgroups: comp.arch
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <33d5e9b128134f83540aaaa460b6be0a@news.novabbs.org>
Lines: 55
Message-ID: <5OZpN.70213$CYpe.14489@fx40.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 17 Jan 2024 23:55:45 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 17 Jan 2024 23:55:45 GMT
X-Received-Bytes: 2888
 by: Scott Lurndal - Wed, 17 Jan 2024 23:55 UTC

mitchalsup@aol.com (MitchAlsup1) writes:
>EricP wrote:
>
>> Quadibloc wrote:
>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.
>
>> It needs to save the portion of the machine state overwritten by that
>> interrupt. Often this is a small subset of the whole state because many
>> interrupts only need a few integer registers, maybe 6 or 7.
>
>Would an interrupt handler not run fewer instructions if its register
>state was seeded with pointers of use to the device(s) being serviced ??

I doubt that would have any effect one way or the other on the
number of instructions executed by the handler (a difference of one
instruction isn't significant).

>
>> Additional integer state will be saved and restored as needed by the call ABI
>> so does not need to be done for every interrupt by the handler prologue.
>
>> This allows the OS to only save and restore the full state on thread
>> switch which only happens after something significant occurs that
>> changes the highest priority thread on a particular core.
>
>Doesn't running a SoftIRQ (or DPC) require a full register state ??

Those are run in a separate kernel thread not the interrupt
handler. They havve full context, provided by the thread.

>And don't most device initerrupts need to SoftIRQ ??

Some do, some don't. It really depends on the interrupt
and the operating software (i.e. the linux kernel stack,
which is structured around PCIe semantics).

>> I have trouble imagining what an interrupt handler might use vectors for.
>
>Memory to memory move from Disk Cache to User Buffer.

That's DMA - no cpu intervention required. If you're referring
to a "Soft" disk cache maintained by the kernel (in unix, the
buffer cache or file cache), a dedicated DMA engine that can offload
such transfers would be a better solution than using
vector registers in an interrupt handler which has no business
transferring bulk data.

>SoftIRQ might use Vector arithmetic to verify CRC, Encryption, ...

Both of those are offloaded to on-chip accelerators. Much better
use of area.

Re: Interrupts on the Concertina II

<c168e8bb229ff12236468563107c8822@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36911&group=comp.arch#36911

  copy link   Newsgroups: comp.arch
Date: Thu, 18 Jan 2024 00:01:33 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$2cG0ZjjMmYVxe2hAT3RpH.gD68QK4hZNTQSS/wa2L.V5WO/Gi6D5K
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org> <uo9pa2$286lv$1@dont-email.me>
Organization: Rocksolid Light
Message-ID: <c168e8bb229ff12236468563107c8822@www.novabbs.org>
 by: MitchAlsup1 - Thu, 18 Jan 2024 00:01 UTC

Chris M. Thomasson wrote:

> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>> Quadibloc wrote:
>>
>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.
>>
>> State needs to be saved, whether SW or HW does the save is a free variable.
>>
>>> This is because interrupts can happen at any time, and thus
>>> programs don't prepare for them or expect them. Any disturbance
>>> to the contents of any register would risk causing programs to
>>> crash.
>>
>> Also note:: the ABA problem can happen when an interrupt transpires
>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>> before transferring control to the interrupt handler.
> [...]

> Just to be clear an interrupt occurring within the hardware
> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
> should not effect the outcome of the CAS. Actually, it should not happen
> at all, right? CAS does not have any spurious failures.

ABA failure happens BECAUSE one uses the value of data to decide if
something appeared ATOMIC. The CAS instruction (itself and all variants)
is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
to be compared was fetched without any ATOMIC indicator, and someone else
can alter it before CAS. If more than 1 thread alters the location, it
can (seldom) end up with the same data value as the suspended thread
thought it should be.

CAS is ATOMIC, the code leading to CAS was not and this opens up the
hole.

Note:: CAS functionality implemented with LL/SC does not suffer ABA
because the core monitors the LL address until the SC is performed.
It is an addressed based comparison not a data value based one.

Re: Interrupts on the Concertina II

<RC%pN.168183$vFZa.59272@fx13.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36913&group=comp.arch#36913

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx13.iad.POSTED!not-for-mail
From: ThatWouldBeTelling@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <33d5e9b128134f83540aaaa460b6be0a@news.novabbs.org>
In-Reply-To: <33d5e9b128134f83540aaaa460b6be0a@news.novabbs.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 89
Message-ID: <RC%pN.168183$vFZa.59272@fx13.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Thu, 18 Jan 2024 02:00:17 UTC
Date: Wed, 17 Jan 2024 21:00:06 -0500
X-Received-Bytes: 4716
 by: EricP - Thu, 18 Jan 2024 02:00 UTC

MitchAlsup1 wrote:
> EricP wrote:
>
>> Quadibloc wrote:
>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.
>
>> It needs to save the portion of the machine state overwritten by that
>> interrupt. Often this is a small subset of the whole state because many
>> interrupts only need a few integer registers, maybe 6 or 7.
>
> Would an interrupt handler not run fewer instructions if its register
> state was seeded with pointers of use to the device(s) being serviced ??

It would save a couple of load immediate instructions and
costs a set of preserved registers for each interrupt level.
Not worth the trouble.

>> Additional integer state will be saved and restored as needed by the
>> call ABI
>> so does not need to be done for every interrupt by the handler prologue.
>
>> This allows the OS to only save and restore the full state on thread
>> switch which only happens after something significant occurs that
>> changes the highest priority thread on a particular core.
>
> Doesn't running a SoftIRQ (or DPC) require a full register state ??
> And don't most device initerrupts need to SoftIRQ ??
> {{Yes, I see timer interrupts not needing so much of that}}

No, not if you layer the software appropriately.

The ISR prologue saves the non-preserved register subset (say R0 to R7).
The First Level Interrupt Handler (FLIH) determines whether to
restore the saved register subset or jump into the OS.
If it decides to jump into the OS then R0:R7 are already saved on the stack,
and since this was a FLIH that stack must be the prior thread kernel stack.
So that leaves R8:R31 as still containing the prior threads values.

You call whatever routines you like, when they return to this routine
R8:R31 will still contain the prior thread's data. Only when you decide
to switch threads do you needs to spill R8:R31, into the thread header
context save area, plus any float, simd or vector registers,
and then save the kernel stack pointer there so you can find the values
you pushed in the prologue (if you need to edit the thread context).

You then switch thread header pointers to the new thread's.

To load the next thread you pick up from the new thread context R8:R31
and float, simd, vector registers, and the kernel stack pointer.
Its R0:R7 remain on the kernel stack where they were left when saved.

You can now return to the ISR epilogue which pops R0:R7 for this new
thread and REI Return from Exception or Interrupt to run the new thread.

>> This occurs much less than the frequency of interrupts.
>
>>> This is because interrupts can happen at any time, and thus
>>> programs don't prepare for them or expect them. Any disturbance
>>> to the contents of any register would risk causing programs to
>>> crash.
>>>
>>> The Concertina II has a potentially large machine state which most
>>> programs do not use. There are vector registers, of the huge
>>> kind found in the Cray I. There are banks of 128 registers to
>>> supplement the banks of 32 registers.
>
>> I have trouble imagining what an interrupt handler might use vectors for.
>
> Memory to memory move from Disk Cache to User Buffer.
> SoftIRQ might use Vector arithmetic to verify CRC, Encryption, ...

I was thinking of device interrupt service routines but yeah
the DPC/SoftIRQ routines might do this.

I would have those routines that do want this manually save and restore
any non-integer registers. There may be other sync issues to deal with
(pending exceptions intended for the prior thread context).

A set of utility Hardware Abstraction Layer (HAL) subroutines could
handle this for each platform.

>> Some OS's deal with this by specifying that drivers can only use
>> integers.
>> (Graphics drivers get special dispensation but they run in special
>> context.)

Re: Interrupts on the Concertina II

<uoag35$2fubj$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36916&group=comp.arch#36916

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: quadibloc@servername.invalid (Quadibloc)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Thu, 18 Jan 2024 06:22:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <uoag35$2fubj$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 18 Jan 2024 06:22:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ad50a7ee05bbfd46a867c9422da73aa4";
logging-data="2619763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vg12l+xBmRy7Cs+MeJpV1zaWFUE6X+G0="
User-Agent: Pan/0.146 (Hic habitat felicitas; d7a48b4
gitlab.gnome.org/GNOME/pan.git)
Cancel-Lock: sha1:yAE4rrovK8JJ+JPIyyP7nvrnr7Q=
 by: Quadibloc - Thu, 18 Jan 2024 06:22 UTC

On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
> Quadibloc wrote:

>> When a computer recieves an interrupt signal, it needs to save
>> the complete machine state, so that upon return from the
>> interrupt, the program thus interrupted is in no way affected.
>
> It needs to save the portion of the machine state overwritten by that
> interrupt. Often this is a small subset of the whole state because many
> interrupts only need a few integer registers, maybe 6 or 7.
> Additional integer state will be saved and restored as needed by the call ABI
> so does not need to be done for every interrupt by the handler prologue.

Yes, that is true in many cases.

> I have trouble imagining what an interrupt handler might use vectors for.

However, you're apparently forgetting one very important case.

What if the interrupt is a *real-time clock* interrupt, and what is going
to happen is that the computer will _not_ return immediately from that
interrupt to the interrupted program, but instead, regarding it as
compute-bound, proceed to a different program possibly even belonging
to another user?

So you're quite correct that the problem does not _always_ arise. But it
does arise on occasion.

John Savard

Re: Interrupts on the Concertina II

<OwbqN.60118$Vrtf.6995@fx39.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36922&group=comp.arch#36922

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!rocksolid2!news.neodome.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx39.iad.POSTED!not-for-mail
From: ThatWouldBeTelling@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoag35$2fubj$1@dont-email.me>
In-Reply-To: <uoag35$2fubj$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 62
Message-ID: <OwbqN.60118$Vrtf.6995@fx39.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Thu, 18 Jan 2024 15:33:02 UTC
Date: Thu, 18 Jan 2024 10:31:22 -0500
X-Received-Bytes: 3561
 by: EricP - Thu, 18 Jan 2024 15:31 UTC

Quadibloc wrote:
> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>> Quadibloc wrote:
>
>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.
>> It needs to save the portion of the machine state overwritten by that
>> interrupt. Often this is a small subset of the whole state because many
>> interrupts only need a few integer registers, maybe 6 or 7.
>> Additional integer state will be saved and restored as needed by the call ABI
>> so does not need to be done for every interrupt by the handler prologue.
>
> Yes, that is true in many cases.
>
>> I have trouble imagining what an interrupt handler might use vectors for.
>
> However, you're apparently forgetting one very important case.
>
> What if the interrupt is a *real-time clock* interrupt, and what is going
> to happen is that the computer will _not_ return immediately from that
> interrupt to the interrupted program, but instead, regarding it as
> compute-bound, proceed to a different program possibly even belonging
> to another user?
>
> So you're quite correct that the problem does not _always_ arise. But it
> does arise on occasion.
>
> John Savard

No, I'm not forgetting that. Return from Exception or Interrupt (REI)
has two possible paths, return to what it was doing before or jump into
the OS and do more processing. On many platforms this particular piece
of code is long, complicated, and riddled with race conditions.

But designing an REI mechanism that makes this sequence
simple, efficient and fast is a separate issue.

For interrupts there are two main pieces of code, the Interrupt Service
Routine (ISR), and post processing routine DPC/SoftIrq.

The ISR for a particular device is called by the OS in response
to a hardware priority interrupt. The ISR may decide it needs further
processing but does not want to block other interrupts while doing it
so ISR posts a request for deferred post processing.

There also can be many restrictions on what an ISR is allowed to do
because the OS designers did not want to, say, force every ISR to
sync with the slow x87 FPU just in case someone wanted to use it.

I would not assume that anything other than integer registers would be
available in an ISR.

In a post processing DPC/SoftIrq routine it might be possible but again
there can be limitations. What you don't ever want to happen is to hang
the cpu waiting to sync with a piece of hardware so you can save its state,
as might happen if it was a co-processor. You also don't want to have to
save any state just in case a post routine might want to do something,
but rather save/restore the state on demand and just what is needed.
So it really depends on the device and the platform.

Re: Interrupts on the Concertina II

<uoc3qp$2ogov$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36931&group=comp.arch#36931

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Thu, 18 Jan 2024 13:05:28 -0800
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <uoc3qp$2ogov$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me>
<c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
<uo9pa2$286lv$1@dont-email.me>
<c168e8bb229ff12236468563107c8822@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Jan 2024 21:05:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cc6405ddd276c3b4eb7c996db44b0166";
logging-data="2900767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wj3jh7l/3pE6RDDVyUc5YODNT0NsLwP0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:F8I5mytSkOWrI6jZCDQ1Czpxxmo=
In-Reply-To: <c168e8bb229ff12236468563107c8822@www.novabbs.org>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 18 Jan 2024 21:05 UTC

On 1/17/2024 4:01 PM, MitchAlsup1 wrote:
> Chris M. Thomasson wrote:
>
>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>> Quadibloc wrote:
>>>
>>>> When a computer recieves an interrupt signal, it needs to save
>>>> the complete machine state, so that upon return from the
>>>> interrupt, the program thus interrupted is in no way affected.
>>>
>>> State needs to be saved, whether SW or HW does the save is a free
>>> variable.
>>>
>>>> This is because interrupts can happen at any time, and thus
>>>> programs don't prepare for them or expect them. Any disturbance
>>>> to the contents of any register would risk causing programs to
>>>> crash.
>>>
>>> Also note:: the ABA problem can happen when an interrupt transpires
>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>> before transferring control to the interrupt handler.
>> [...]
>
>> Just to be clear an interrupt occurring within the hardware
>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>> should not effect the outcome of the CAS. Actually, it should not
>> happen at all, right? CAS does not have any spurious failures.
>
> ABA failure happens BECAUSE one uses the value of data to decide if
> something appeared ATOMIC. The CAS instruction (itself and all variants)
> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
> to be compared was fetched without any ATOMIC indicator, and someone else
> can alter it before CAS. If more than 1 thread alters the location, it
> can (seldom) end up with the same data value as the suspended thread
> thought it should be.

Yup. Fwiw, some years ago I actually tried to BURN a CAS by creating
several rouge threads that would alter the CAS target using random
numbers at full speed ahead. The interesting part is that forward
progress was damaged for sure, but still occurred. It did not live lock
on me. Interesting.

> CAS is ATOMIC, the code leading to CAS was not and this opens up the hole.

Indeed.

> Note:: CAS functionality implemented with LL/SC does not suffer ABA
> because the core monitors the LL address until the SC is performed.
> It is an addressed based comparison not a data value based one.

Exactly. Actually, I asked myself if I just wrote a stupid question to
you. Sorry Mitch... ;^)

Re: Interrupts on the Concertina II

<uoc3v3$2ogor$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36932&group=comp.arch#36932

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Thu, 18 Jan 2024 13:07:46 -0800
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uoc3v3$2ogor$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me>
<c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
<uo9pa2$286lv$1@dont-email.me>
<c168e8bb229ff12236468563107c8822@www.novabbs.org>
<uoc3qp$2ogov$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Jan 2024 21:07:47 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cc6405ddd276c3b4eb7c996db44b0166";
logging-data="2900763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zfvr0+wpDxbjyoxXB8F4Rk7xwrxDIs+Q="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:C/uWlL8AlqvO1MUn26Nhfgc8LCk=
Content-Language: en-US
In-Reply-To: <uoc3qp$2ogov$1@dont-email.me>
 by: Chris M. Thomasson - Thu, 18 Jan 2024 21:07 UTC

On 1/18/2024 1:05 PM, Chris M. Thomasson wrote:
> On 1/17/2024 4:01 PM, MitchAlsup1 wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>>> Quadibloc wrote:
>>>>
>>>>> When a computer recieves an interrupt signal, it needs to save
>>>>> the complete machine state, so that upon return from the
>>>>> interrupt, the program thus interrupted is in no way affected.
>>>>
>>>> State needs to be saved, whether SW or HW does the save is a free
>>>> variable.
>>>>
>>>>> This is because interrupts can happen at any time, and thus
>>>>> programs don't prepare for them or expect them. Any disturbance
>>>>> to the contents of any register would risk causing programs to
>>>>> crash.
>>>>
>>>> Also note:: the ABA problem can happen when an interrupt transpires
>>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>>> before transferring control to the interrupt handler.
>>> [...]
>>
>>> Just to be clear an interrupt occurring within the hardware
>>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>>> should not effect the outcome of the CAS. Actually, it should not
>>> happen at all, right? CAS does not have any spurious failures.
>>
>> ABA failure happens BECAUSE one uses the value of data to decide if
>> something appeared ATOMIC. The CAS instruction (itself and all variants)
>> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
>> to be compared was fetched without any ATOMIC indicator, and someone else
>> can alter it before CAS. If more than 1 thread alters the location, it
>> can (seldom) end up with the same data value as the suspended thread
>> thought it should be.
>
> Yup. Fwiw, some years ago I actually tried to BURN a CAS by creating
> several rouge threads that would alter the CAS target using random
> numbers at full speed ahead. The interesting part is that forward
> progress was damaged for sure, but still occurred. It did not live lock
> on me. Interesting.

I compared CAS successes vs failures. When the rouge threads were turned
on, the failure rate went way up, but not to a point where an actual
sustained livelock occurred.

>> CAS is ATOMIC, the code leading to CAS was not and this opens up the
>> hole.
>
> Indeed.
>
>
>> Note:: CAS functionality implemented with LL/SC does not suffer ABA
>> because the core monitors the LL address until the SC is performed.
>> It is an addressed based comparison not a data value based one.
>
> Exactly. Actually, I asked myself if I just wrote a stupid question to
> you. Sorry Mitch... ;^)

Re: Interrupts on the Concertina II

<P2yqN.362492$83n7.220225@fx18.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36952&group=comp.arch#36952

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.swapon.de!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx18.iad.POSTED!not-for-mail
From: ThatWouldBeTelling@thevillage.com (EricP)
User-Agent: Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version: 1.0
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
References: <uo930v$24cq0$1@dont-email.me> <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org> <uo9pa2$286lv$1@dont-email.me> <c168e8bb229ff12236468563107c8822@www.novabbs.org>
In-Reply-To: <c168e8bb229ff12236468563107c8822@www.novabbs.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 68
Message-ID: <P2yqN.362492$83n7.220225@fx18.iad>
X-Complaints-To: abuse@UsenetServer.com
NNTP-Posting-Date: Fri, 19 Jan 2024 17:11:11 UTC
Date: Fri, 19 Jan 2024 12:10:56 -0500
X-Received-Bytes: 4005
 by: EricP - Fri, 19 Jan 2024 17:10 UTC

MitchAlsup1 wrote:
> Chris M. Thomasson wrote:
>
>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>> Quadibloc wrote:
>>>
>>>> When a computer recieves an interrupt signal, it needs to save
>>>> the complete machine state, so that upon return from the
>>>> interrupt, the program thus interrupted is in no way affected.
>>>
>>> State needs to be saved, whether SW or HW does the save is a free
>>> variable.
>>>
>>>> This is because interrupts can happen at any time, and thus
>>>> programs don't prepare for them or expect them. Any disturbance
>>>> to the contents of any register would risk causing programs to
>>>> crash.
>>>
>>> Also note:: the ABA problem can happen when an interrupt transpires
>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>> before transferring control to the interrupt handler.
>> [...]
>
>> Just to be clear an interrupt occurring within the hardware
>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>> should not effect the outcome of the CAS. Actually, it should not
>> happen at all, right? CAS does not have any spurious failures.
>
> ABA failure happens BECAUSE one uses the value of data to decide if
> something appeared ATOMIC. The CAS instruction (itself and all variants)
> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
> to be compared was fetched without any ATOMIC indicator, and someone else
> can alter it before CAS. If more than 1 thread alters the location, it
> can (seldom) end up with the same data value as the suspended thread
> thought it should be.
>
> CAS is ATOMIC, the code leading to CAS was not and this opens up the hole.
>
> Note:: CAS functionality implemented with LL/SC does not suffer ABA
> because the core monitors the LL address until the SC is performed.
> It is an addressed based comparison not a data value based one.

Yes but an equal point of view is that LL/SC only emulates atomic and
uses the cache line ownership grab while "locked" to detect possible
interference and infer potential change.

Note that if LL/SC is implemented with temporary line pinning
(as might be done to guarantee forward progress and prevent ping-pong)
then it cannot be interfered with, and CAS and atomic-fetch-op sequences
are semantically identical to the equivalent single instructions
(which may also be implemented with temporary line pinning if their
data must move from cache through the core and back).

Also LL/SC as implemented on Alpha, MIPS, Power, ARM, RISC-V don't allow
any other location loads or stores between them so really aren't useful
for detecting ABA because detecting it requires monitoring two memory
locations for change.

The classic example is the single linked list with items head->A->B->C
Detecting ABA requires monitoring if either head or head->Next change
which LL/SC cannot do as reading head->Next cancels the lock on head.

x86 has cmpxchg8b and ARM has double wide LL/SC which can be used to
implement CASD atomic-double-wide-compare-and-swap. The first word holds
the head pointer and the second word holds a generation counter whose
change is used to infer that head->Next might have changed.

Re: Interrupts on the Concertina II

<uoetqg$3amth$5@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36967&group=comp.arch#36967

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m.thomasson.1@gmail.com (Chris M. Thomasson)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Fri, 19 Jan 2024 14:41:20 -0800
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <uoetqg$3amth$5@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me>
<c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org>
<uo9pa2$286lv$1@dont-email.me>
<c168e8bb229ff12236468563107c8822@www.novabbs.org>
<P2yqN.362492$83n7.220225@fx18.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 19 Jan 2024 22:41:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="44184edc633617af7fc7f7c89667ab4f";
logging-data="3496881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WySOxeBXP7sg7r4tOdTLcY7ulMVyuw7I="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Gk9iu8kZynUp99nFFslkL6MMQic=
In-Reply-To: <P2yqN.362492$83n7.220225@fx18.iad>
Content-Language: en-US
 by: Chris M. Thomasson - Fri, 19 Jan 2024 22:41 UTC

On 1/19/2024 9:10 AM, EricP wrote:
> MitchAlsup1 wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>>> Quadibloc wrote:
>>>>
>>>>> When a computer recieves an interrupt signal, it needs to save
>>>>> the complete machine state, so that upon return from the
>>>>> interrupt, the program thus interrupted is in no way affected.
>>>>
>>>> State needs to be saved, whether SW or HW does the save is a free
>>>> variable.
>>>>
>>>>> This is because interrupts can happen at any time, and thus
>>>>> programs don't prepare for them or expect them. Any disturbance
>>>>> to the contents of any register would risk causing programs to
>>>>> crash.
>>>>
>>>> Also note:: the ABA problem can happen when an interrupt transpires
>>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>>> before transferring control to the interrupt handler.
>>> [...]
>>
>>> Just to be clear an interrupt occurring within the hardware
>>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>>> should not effect the outcome of the CAS. Actually, it should not
>>> happen at all, right? CAS does not have any spurious failures.
>>
>> ABA failure happens BECAUSE one uses the value of data to decide if
>> something appeared ATOMIC. The CAS instruction (itself and all variants)
>> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
>> to be compared was fetched without any ATOMIC indicator, and someone else
>> can alter it before CAS. If more than 1 thread alters the location, it
>> can (seldom) end up with the same data value as the suspended thread
>> thought it should be.
>>
>> CAS is ATOMIC, the code leading to CAS was not and this opens up the
>> hole.
>>
>> Note:: CAS functionality implemented with LL/SC does not suffer ABA
>> because the core monitors the LL address until the SC is performed.
>> It is an addressed based comparison not a data value based one.
>
> Yes but an equal point of view is that LL/SC only emulates atomic and
> uses the cache line ownership grab while "locked" to detect possible
> interference and infer potential change.
>
> Note that if LL/SC is implemented with temporary line pinning
> (as might be done to guarantee forward progress and prevent ping-pong)
> then it cannot be interfered with, and CAS and atomic-fetch-op sequences
> are semantically identical to the equivalent single instructions
> (which may also be implemented with temporary line pinning if their
> data must move from cache through the core and back).
>
> Also LL/SC as implemented on Alpha, MIPS, Power, ARM, RISC-V don't allow
> any other location loads or stores between them so really aren't useful
> for detecting ABA because detecting it requires monitoring two memory
> locations for change.
>
> The classic example is the single linked list with items head->A->B->C
> Detecting ABA requires monitoring if either head or head->Next change
> which LL/SC cannot do as reading head->Next cancels the lock on head.
>
> x86 has cmpxchg8b and ARM has double wide LL/SC which can be used to
> implement CASD atomic-double-wide-compare-and-swap. The first word holds
> the head pointer and the second word holds a generation counter whose
> change is used to infer that head->Next might have changed.
>
>

Pretty much it. ABA is explicitly mentioned in an IBM principals of
operation wrt Free-Pool Manipulation in an appendix A-48:

https://www.ibm.com/support/pages/sites/default/files/inline-files/SA22-7832-00.pdf

The problem will destroy the integrity of the list. Perform Locked
Operation (PLO) in the same appendix is pretty interesting as well... ;^)

Re: Interrupts on the Concertina II

<uoh4t9$3pht2$2@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36977&group=comp.arch#36977

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: quadibloc@servername.invalid (Quadibloc)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Sat, 20 Jan 2024 18:54:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <uoh4t9$3pht2$2@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 Jan 2024 18:54:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d56877ef8ab4a9bee28b0e95cc7a915d";
logging-data="3983266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Fd/2H+QiVlRBbaGUuL1adMBp+LiasrxM="
User-Agent: Pan/0.146 (Hic habitat felicitas; d7a48b4
gitlab.gnome.org/GNOME/pan.git)
Cancel-Lock: sha1:UErbmn5eJre2g8h+OufgrW4K0fE=
 by: Quadibloc - Sat, 20 Jan 2024 18:54 UTC

On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
> Quadibloc wrote:

>> When a computer recieves an interrupt signal, it needs to save
>> the complete machine state, so that upon return from the
>> interrupt, the program thus interrupted is in no way affected.

> It needs to save the portion of the machine state overwritten by that
> interrupt. Often this is a small subset of the whole state because many
> interrupts only need a few integer registers, maybe 6 or 7.
> Additional integer state will be saved and restored as needed by the call ABI
> so does not need to be done for every interrupt by the handler prologue.

Having been so concerned by the large machine state of the Concertina
II, parts of which were rarely used, and not realizing the conventional
approach was entirely adequate... I missed what was the biggest flaw in
interrupts on the Concertina II.

Because in some important ways it is patterned after the IBM System/360,
it shares its biggest problem with interrupts.

On the System/360, it is a *convention* that the last few general registers,
registers 11, 12, 13, 14, and 15 or so, are used as base registers. A
base register *must* be properly set up before a program can write any data
to memory.

So one can't just have an interrupt behave like on an 8-bit microprocessor,
saving only the program counter and the status bits, and leaving any
registers to be saved by software. At least some of the general registers
have to be saved, and set up with new starting values, for the interrupt
routine to be able to save anything else, if need be.

Of course, the System/360 was able to solve this problem, so it's not
intractable. But the fact that the System/360 solved it by saving all
sixteen general registers, and then loading them from an area in memory
allocated to that interrupt type, is what fooled me into thinking I
would need to automatically save _everything_. It didn't save the
floating-point registers - software did, if the need was to move to
a different user's program, and saving the state in two separate pieces
by two different parts of the OS did not cause hopeless confusion.

John Savard

Re: Interrupts on the Concertina II

<uojugt$buth$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36990&group=comp.arch#36990

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cr88192@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Sun, 21 Jan 2024 14:23:55 -0600
Organization: A noiseless patient Spider
Lines: 89
Message-ID: <uojugt$buth$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad>
<uoh4t9$3pht2$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 21 Jan 2024 20:23:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c6621794b7bd50877ce9ff2ee094aea";
logging-data="392113"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MMFh1us+7kSv8hVR9cFgA"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:do6IdUyacqASGnNJw6vipcmyzEQ=
In-Reply-To: <uoh4t9$3pht2$2@dont-email.me>
Content-Language: en-US
 by: BGB - Sun, 21 Jan 2024 20:23 UTC

On 1/20/2024 12:54 PM, Quadibloc wrote:
> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>> Quadibloc wrote:
>
>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.
>
>> It needs to save the portion of the machine state overwritten by that
>> interrupt. Often this is a small subset of the whole state because many
>> interrupts only need a few integer registers, maybe 6 or 7.
>> Additional integer state will be saved and restored as needed by the call ABI
>> so does not need to be done for every interrupt by the handler prologue.
>
> Having been so concerned by the large machine state of the Concertina
> II, parts of which were rarely used, and not realizing the conventional
> approach was entirely adequate... I missed what was the biggest flaw in
> interrupts on the Concertina II.
>
> Because in some important ways it is patterned after the IBM System/360,
> it shares its biggest problem with interrupts.
>
> On the System/360, it is a *convention* that the last few general registers,
> registers 11, 12, 13, 14, and 15 or so, are used as base registers. A
> base register *must* be properly set up before a program can write any data
> to memory.
>
> So one can't just have an interrupt behave like on an 8-bit microprocessor,
> saving only the program counter and the status bits, and leaving any
> registers to be saved by software. At least some of the general registers
> have to be saved, and set up with new starting values, for the interrupt
> routine to be able to save anything else, if need be.
>

IIRC, saving off PC, some flags bits, swapping the stack registers, and
doing a computed branch relative to a control register (via bit-slicing,
*). This is effectively the interrupt mechanism I am using on a 64-bit ISA.

*: For a table that is generally one-off in the kernel or similar, it
doesn't ask much to mandate that it has a certain alignment. And if the
required alignment is larger than the size of the table, you have just
saved yourself needing an adder...

If anything, it is a little simpler than the mechanism used on some
8-bit systems, which would have needed a mechanism to push these values
to the stack, and restore them from the stack.

Having side-channels that allow these values to "magically appear" in
certain SPRs is at least simpler, though the cost of the logic itself
could be more up for debate.

> Of course, the System/360 was able to solve this problem, so it's not
> intractable. But the fact that the System/360 solved it by saving all
> sixteen general registers, and then loading them from an area in memory
> allocated to that interrupt type, is what fooled me into thinking I
> would need to automatically save _everything_. It didn't save the
> floating-point registers - software did, if the need was to move to
> a different user's program, and saving the state in two separate pieces
> by two different parts of the OS did not cause hopeless confusion.
>

For ISR convenience, it would make sense to have, say, two SPR's or CR's
designated for ISR use to squirrel off values from GPRs to make the
prolog/epilog easier. Had considered this, but not done so (in this
case, first thing the ISR does is save a few registers to the ISR stack
to free them up to get the rest of the registers saved "more properly",
then has to do a secondary reload to get these registers back into the
correct place).

Assuming interrupts aren't too common, then it isn't a huge issue, and
seemingly a majority of the clock-cycles spent on interrupt entry mostly
have to do with L1 misses (since typically pretty much nothing the ISR
touches is in the L1 cache; and in my implementation, ISR's may not
share L1 cache lines with non-ISR code; so basically it is an
architecturally required "L1 miss" storm).

Only real way to avoid a lot of the L1 misses would be to have multiple
sets of banked registers or similar, but, this is not cheap for the
hardware... Similarly, the ISR would need to do as little, and touch as
little memory, as is possible to perform its task.

> John Savard

Re: Interrupts on the Concertina II

<3f2ebe5753d55c9630e376d28df91395@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36991&group=comp.arch#36991

  copy link   Newsgroups: comp.arch
Date: Sun, 21 Jan 2024 20:54:05 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$j508pqxLouV3thbbfR09teDkJ6KjO36jpLI9eWOjltElT42zxSnmu
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoag35$2fubj$1@dont-email.me> <OwbqN.60118$Vrtf.6995@fx39.iad>
Organization: Rocksolid Light
Message-ID: <3f2ebe5753d55c9630e376d28df91395@www.novabbs.org>
 by: MitchAlsup1 - Sun, 21 Jan 2024 20:54 UTC

EricP wrote:

> There also can be many restrictions on what an ISR is allowed to do
> because the OS designers did not want to, say, force every ISR to
> sync with the slow x87 FPU just in case someone wanted to use it.

What about all the architectures that are not x86 and do not need to synch
to FP, Vectors, SIMD, ..... ?? Why are they constrained by the one badly
designed long life architecture ??

> I would not assume that anything other than integer registers would be
> available in an ISR.

This is quite reasonable: as long as you have a sufficient number that
the ISR can be written in some HLL without a bunch of flags to the compiler.

> In a post processing DPC/SoftIrq routine it might be possible but again
> there can be limitations. What you don't ever want to happen is to hang
> the cpu waiting to sync with a piece of hardware so you can save its state,
> as might happen if it was a co-processor. You also don't want to have to
> save any state just in case a post routine might want to do something,
> but rather save/restore the state on demand and just what is needed.
> So it really depends on the device and the platform.

As long as there are not more than one flag to clue the compiler in,
I am on board.

Re: Interrupts on the Concertina II

<cb1632fb359dd254fbc878dee5a2d815@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36992&group=comp.arch#36992

  copy link   Newsgroups: comp.arch
Date: Sun, 21 Jan 2024 20:55:40 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$/t98XC/W.8wT8MgEMmYyEuwaTcoDGdGU4/HvzaMqrf/C/k4AHN8.u
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org> <uo9pa2$286lv$1@dont-email.me> <c168e8bb229ff12236468563107c8822@www.novabbs.org> <uoc3qp$2ogov$1@dont-email.me>
Organization: Rocksolid Light
Message-ID: <cb1632fb359dd254fbc878dee5a2d815@www.novabbs.org>
 by: MitchAlsup1 - Sun, 21 Jan 2024 20:55 UTC

Chris M. Thomasson wrote:

> On 1/17/2024 4:01 PM, MitchAlsup1 wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>>> Quadibloc wrote:
>>>>
>>>>> When a computer recieves an interrupt signal, it needs to save
>>>>> the complete machine state, so that upon return from the
>>>>> interrupt, the program thus interrupted is in no way affected.
>>>>
>>>> State needs to be saved, whether SW or HW does the save is a free
>>>> variable.
>>>>
>>>>> This is because interrupts can happen at any time, and thus
>>>>> programs don't prepare for them or expect them. Any disturbance
>>>>> to the contents of any register would risk causing programs to
>>>>> crash.
>>>>
>>>> Also note:: the ABA problem can happen when an interrupt transpires
>>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>>> before transferring control to the interrupt handler.
>>> [...]
>>
>>> Just to be clear an interrupt occurring within the hardware
>>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>>> should not effect the outcome of the CAS. Actually, it should not
>>> happen at all, right? CAS does not have any spurious failures.
>>
>> ABA failure happens BECAUSE one uses the value of data to decide if
>> something appeared ATOMIC. The CAS instruction (itself and all variants)
>> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
>> to be compared was fetched without any ATOMIC indicator, and someone else
>> can alter it before CAS. If more than 1 thread alters the location, it
>> can (seldom) end up with the same data value as the suspended thread
>> thought it should be.

> Yup. Fwiw, some years ago I actually tried to BURN a CAS by creating
> several rouge threads that would alter the CAS target using random
> numbers at full speed ahead. The interesting part is that forward
> progress was damaged for sure, but still occurred. It did not live lock
> on me. Interesting.

>> CAS is ATOMIC, the code leading to CAS was not and this opens up the hole.

> Indeed.

>> Note:: CAS functionality implemented with LL/SC does not suffer ABA
>> because the core monitors the LL address until the SC is performed.
>> It is an addressed based comparison not a data value based one.

> Exactly. Actually, I asked myself if I just wrote a stupid question to
> you. Sorry Mitch... ;^)

No need to be sorry, this is a NG dedicated to make people think, and
then after they have expressed what they though, to correct and refine
what they think and how.

Re: Interrupts on the Concertina II

<af6c065ea55651f0faa67d1cdb768cb0@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36993&group=comp.arch#36993

  copy link   Newsgroups: comp.arch
Date: Sun, 21 Jan 2024 20:58:51 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$fcVQeNKkvIRZ.scb5GhUReDM2PYMDvF53OZS/BNxBJAZANrszci3S
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <c11eb332fac9497c3b5c75bfdc7c2eb3@news.novabbs.org> <uo9pa2$286lv$1@dont-email.me> <c168e8bb229ff12236468563107c8822@www.novabbs.org> <P2yqN.362492$83n7.220225@fx18.iad>
Organization: Rocksolid Light
Message-ID: <af6c065ea55651f0faa67d1cdb768cb0@www.novabbs.org>
 by: MitchAlsup1 - Sun, 21 Jan 2024 20:58 UTC

EricP wrote:

> MitchAlsup1 wrote:
>> Chris M. Thomasson wrote:
>>
>>> On 1/17/2024 2:11 PM, MitchAlsup1 wrote:
>>>> Quadibloc wrote:
>>>>
>>>>> When a computer recieves an interrupt signal, it needs to save
>>>>> the complete machine state, so that upon return from the
>>>>> interrupt, the program thus interrupted is in no way affected.
>>>>
>>>> State needs to be saved, whether SW or HW does the save is a free
>>>> variable.
>>>>
>>>>> This is because interrupts can happen at any time, and thus
>>>>> programs don't prepare for them or expect them. Any disturbance
>>>>> to the contents of any register would risk causing programs to
>>>>> crash.
>>>>
>>>> Also note:: the ABA problem can happen when an interrupt transpires
>>>> in the middle of an ATOMIC sequence. Thus, My 66000 fails the event
>>>> before transferring control to the interrupt handler.
>>> [...]
>>
>>> Just to be clear an interrupt occurring within the hardware
>>> implementation of a CAS operation (e.g, lock cmpxchg over on Intel)
>>> should not effect the outcome of the CAS. Actually, it should not
>>> happen at all, right? CAS does not have any spurious failures.
>>
>> ABA failure happens BECAUSE one uses the value of data to decide if
>> something appeared ATOMIC. The CAS instruction (itself and all variants)
>> is ATOMIC, the the setup to CAS is non-ATOMIC, because the original value
>> to be compared was fetched without any ATOMIC indicator, and someone else
>> can alter it before CAS. If more than 1 thread alters the location, it
>> can (seldom) end up with the same data value as the suspended thread
>> thought it should be.
>>
>> CAS is ATOMIC, the code leading to CAS was not and this opens up the hole.
>>
>> Note:: CAS functionality implemented with LL/SC does not suffer ABA
>> because the core monitors the LL address until the SC is performed.
>> It is an addressed based comparison not a data value based one.

> Yes but an equal point of view is that LL/SC only emulates atomic and
> uses the cache line ownership grab while "locked" to detect possible
> interference and infer potential change.

Which, BTW, opens up a different side channel ...

> Note that if LL/SC is implemented with temporary line pinning
> (as might be done to guarantee forward progress and prevent ping-pong)
> then it cannot be interfered with, and CAS and atomic-fetch-op sequences
> are semantically identical to the equivalent single instructions
> (which may also be implemented with temporary line pinning if their
> data must move from cache through the core and back).

Line pinning requires a NAK in the coherence protocol. As far as I know,
only My 66000 interconnect protocol has such a NaK.

> Also LL/SC as implemented on Alpha, MIPS, Power, ARM, RISC-V don't allow
> any other location loads or stores between them so really aren't useful
> for detecting ABA because detecting it requires monitoring two memory
> locations for change.

> The classic example is the single linked list with items head->A->B->C
> Detecting ABA requires monitoring if either head or head->Next change
> which LL/SC cannot do as reading head->Next cancels the lock on head.

Detecting ABA requires one to monitor addresses not data values.

> x86 has cmpxchg8b and ARM has double wide LL/SC which can be used to
> implement CASD atomic-double-wide-compare-and-swap. The first word holds
> the head pointer and the second word holds a generation counter whose
> change is used to infer that head->Next might have changed.

Re: Interrupts on the Concertina II

<f9540836824d5aca225f41b78f32e419@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36994&group=comp.arch#36994

  copy link   Newsgroups: comp.arch
Date: Sun, 21 Jan 2024 21:02:01 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$YXijVWG3Kris0wkDxcofPegemHjx3C.sNI7GV3sBBpH7Hl3jF7mz2
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoh4t9$3pht2$2@dont-email.me>
Organization: Rocksolid Light
Message-ID: <f9540836824d5aca225f41b78f32e419@www.novabbs.org>
 by: MitchAlsup1 - Sun, 21 Jan 2024 21:02 UTC

Quadibloc wrote:

> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>> Quadibloc wrote:

>>> When a computer recieves an interrupt signal, it needs to save
>>> the complete machine state, so that upon return from the
>>> interrupt, the program thus interrupted is in no way affected.

>> It needs to save the portion of the machine state overwritten by that
>> interrupt. Often this is a small subset of the whole state because many
>> interrupts only need a few integer registers, maybe 6 or 7.
>> Additional integer state will be saved and restored as needed by the call ABI
>> so does not need to be done for every interrupt by the handler prologue.

> Having been so concerned by the large machine state of the Concertina
> II, parts of which were rarely used, and not realizing the conventional
> approach was entirely adequate... I missed what was the biggest flaw in
> interrupts on the Concertina II.

The second to last word is misleading and unnecessary::

> interrupts on Concertina II.

The implies there will be only one and it already exists.

> Because in some important ways it is patterned after the IBM System/360,
> it shares its biggest problem with interrupts.

> On the System/360, it is a *convention* that the last few general registers,
> registers 11, 12, 13, 14, and 15 or so, are used as base registers. A
> base register *must* be properly set up before a program can write any data
> to memory.

Captain Obvious strikes again...

> So one can't just have an interrupt behave like on an 8-bit microprocessor,
> saving only the program counter and the status bits, and leaving any
> registers to be saved by software. At least some of the general registers
> have to be saved, and set up with new starting values, for the interrupt
> routine to be able to save anything else, if need be.

Once HW starts saving "a few" it might as well save "enough" of them to mater.

> Of course, the System/360 was able to solve this problem, so it's not
> intractable. But the fact that the System/360 solved it by saving all
> sixteen general registers, and then loading them from an area in memory
> allocated to that interrupt type, is what fooled me into thinking I
> would need to automatically save _everything_. It didn't save the
> floating-point registers - software did, if the need was to move to
> a different user's program, and saving the state in two separate pieces
> by two different parts of the OS did not cause hopeless confusion.

> John Savard

Re: Interrupts on the Concertina II

<ff86faba91c3898f808cce78672bb058@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=36995&group=comp.arch#36995

  copy link   Newsgroups: comp.arch
Date: Sun, 21 Jan 2024 21:18:06 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$mTO9nwjEl0kUhMqoWT27v.rra4Yo6o9uddiI/lgFyr.eUqJ9ezIWW
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoh4t9$3pht2$2@dont-email.me> <uojugt$buth$1@dont-email.me>
Organization: Rocksolid Light
Message-ID: <ff86faba91c3898f808cce78672bb058@www.novabbs.org>
 by: MitchAlsup1 - Sun, 21 Jan 2024 21:18 UTC

BGB wrote:

> On 1/20/2024 12:54 PM, Quadibloc wrote:
>> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>>
>> So one can't just have an interrupt behave like on an 8-bit microprocessor,
>> saving only the program counter and the status bits, and leaving any
>> registers to be saved by software. At least some of the general registers
>> have to be saved, and set up with new starting values, for the interrupt
>> routine to be able to save anything else, if need be.
>>

> IIRC, saving off PC, some flags bits, swapping the stack registers, and
> doing a computed branch relative to a control register (via bit-slicing,
> *). This is effectively the interrupt mechanism I am using on a 64-bit ISA.

And sounds like the interrupt mechanism for an 8-bit µprocessor...

> *: For a table that is generally one-off in the kernel or similar, it
> doesn't ask much to mandate that it has a certain alignment. And if the
> required alignment is larger than the size of the table, you have just
> saved yourself needing an adder...

In a modern system where you have several HyperVisors and a multiplicity
of GuestOSs, a single interrupt table is unworkable looking forward.
What you want and need is every GuestOS to have its own table, and
every HyperVisor have its own table, some kind of routing mechanism to
route device interrupts to the correct table, and inform appropriate
cores of raised and enabled interrupts. All these tables have to be
concurrently available continuously and simultaneously. The old fixed
mapping will no longer work efficiently--you can make them work with
\a near-Herculean amount of carefully programming.

Or you can look at the problem from a modern viewpoint and fix the
model so the above is manifest.

> If anything, it is a little simpler than the mechanism used on some
> 8-bit systems, which would have needed a mechanism to push these values
> to the stack, and restore them from the stack.

Do you think you mechanism would work "well" with 1024 cores in your
system ??

> Having side-channels that allow these values to "magically appear" in
> certain SPRs is at least simpler, though the cost of the logic itself
> could be more up for debate.

Once you have an FMAC FPU none of the interrupt logic adds any area
to any core.

>> Of course, the System/360 was able to solve this problem, so it's not
>> intractable. But the fact that the System/360 solved it by saving all
>> sixteen general registers, and then loading them from an area in memory
>> allocated to that interrupt type, is what fooled me into thinking I
>> would need to automatically save _everything_. It didn't save the
>> floating-point registers - software did, if the need was to move to
>> a different user's program, and saving the state in two separate pieces
>> by two different parts of the OS did not cause hopeless confusion.
>>

> For ISR convenience, it would make sense to have, say, two SPR's or CR's
> designated for ISR use to squirrel off values from GPRs to make the
> prolog/epilog easier. Had considered this, but not done so (in this
> case, first thing the ISR does is save a few registers to the ISR stack
> to free them up to get the rest of the registers saved "more properly",
> then has to do a secondary reload to get these registers back into the
> correct place).

Or, you could take the point of view that your architecture makes context
switching easy (like 1 instruction from application 1 to application 2)
and when you do this the rest of the model pretty much drops in for free.

> Assuming interrupts aren't too common, then it isn't a huge issue, and
> seemingly a majority of the clock-cycles spent on interrupt entry mostly
> have to do with L1 misses (since typically pretty much nothing the ISR
> touches is in the L1 cache; and in my implementation, ISR's may not
> share L1 cache lines with non-ISR code; so basically it is an
> architecturally required "L1 miss" storm).

The fewer cycles before raising the interrupt at the device, and the
servicing of the interrupt by ISR (prior to scheduling a SoftIRQ/DPC)
is the key number. All these little pieces of state that are obtained
1 at a time by running code not in the ICache, along with the manipulations
on the TLBs, ... get in the way of your goal.

> Only real way to avoid a lot of the L1 misses would be to have multiple
> sets of banked registers or similar, but, this is not cheap for the
> hardware... Similarly, the ISR would need to do as little, and touch as
> little memory, as is possible to perform its task.

You can read up thread-state from DRAM and continue what you are working
on until they arrive, and when they arrive, you ship out the old values
as if the core state was a cache in its own right. Thus, you continue to
make progress on the current thread until you have the state needed to
run the ISR thread and when it arrives you have everything you need to
proceed. ...

>> John Savard

Re: Interrupts on the Concertina II

<xsgrN.285248$xHn7.137148@fx14.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=37003&group=comp.arch#37003

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx14.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Interrupts on the Concertina II
Newsgroups: comp.arch
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoh4t9$3pht2$2@dont-email.me> <uojugt$buth$1@dont-email.me> <ff86faba91c3898f808cce78672bb058@www.novabbs.org>
Lines: 18
Message-ID: <xsgrN.285248$xHn7.137148@fx14.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 21 Jan 2024 21:58:53 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 21 Jan 2024 21:58:53 GMT
X-Received-Bytes: 1535
 by: Scott Lurndal - Sun, 21 Jan 2024 21:58 UTC

mitchalsup@aol.com (MitchAlsup1) writes:

>
>In a modern system where you have several HyperVisors and a multiplicity
>of GuestOSs, a single interrupt table is unworkable looking forward.
>What you want and need is every GuestOS to have its own table, and
>every HyperVisor have its own table, some kind of routing mechanism to
>route device interrupts to the correct table, and inform appropriate
>cores of raised and enabled interrupts. All these tables have to be
>concurrently available continuously and simultaneously. The old fixed
>mapping will no longer work efficiently--you can make them work with
>\a near-Herculean amount of carefully programming.

For an extant implementation thereof, see

GICv3 Architecture Specification.

https://documentation-service.arm.com/static/6012f2e54ccc190e5e681256

Re: Interrupts on the Concertina II

<uoka6h$dlog$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=37009&group=comp.arch#37009

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!news.samoylyk.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cr88192@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Interrupts on the Concertina II
Date: Sun, 21 Jan 2024 17:43:12 -0600
Organization: A noiseless patient Spider
Lines: 196
Message-ID: <uoka6h$dlog$1@dont-email.me>
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad>
<uoh4t9$3pht2$2@dont-email.me> <uojugt$buth$1@dont-email.me>
<ff86faba91c3898f808cce78672bb058@www.novabbs.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Jan 2024 23:43:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c3f5f7bcf3cbeca25160f5a4be788e24";
logging-data="448272"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MM8wrEejVSWlatE/YtDua"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:MgzoXgDsVcQM5Ejh9hv43M8wDmg=
In-Reply-To: <ff86faba91c3898f808cce78672bb058@www.novabbs.org>
Content-Language: en-US
 by: BGB - Sun, 21 Jan 2024 23:43 UTC

On 1/21/2024 3:18 PM, MitchAlsup1 wrote:
> BGB wrote:
>
>> On 1/20/2024 12:54 PM, Quadibloc wrote:
>>> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>>>
>>> So one can't just have an interrupt behave like on an 8-bit
>>> microprocessor,
>>> saving only the program counter and the status bits, and leaving any
>>> registers to be saved by software. At least some of the general
>>> registers
>>> have to be saved, and set up with new starting values, for the interrupt
>>> routine to be able to save anything else, if need be.
>>>
>
>> IIRC, saving off PC, some flags bits, swapping the stack registers,
>> and doing a computed branch relative to a control register (via
>> bit-slicing, *). This is effectively the interrupt mechanism I am
>> using on a 64-bit ISA.
>
> And sounds like the interrupt mechanism for an 8-bit µprocessor...
>

It was partly a simplification of the design from the SH-4, which was a
32-bit CPU mostly used in embedded systems (and in the Sega Dreamcast...).

Though, the SH-4 did bank out half the registers, which was a feature
that ended up being dropped for cost-saving reasons.

>> *: For a table that is generally one-off in the kernel or similar, it
>> doesn't ask much to mandate that it has a certain alignment. And if
>> the required alignment is larger than the size of the table, you have
>> just saved yourself needing an adder...
>
> In a modern system where you have several HyperVisors and a multiplicity
> of GuestOSs, a single interrupt table is unworkable looking forward.
> What you want and need is every GuestOS to have its own table, and
> every HyperVisor have its own table, some kind of routing mechanism to
> route device interrupts to the correct table, and inform appropriate
> cores of raised and enabled interrupts. All these tables have to be
> concurrently available continuously and simultaneously. The old fixed
> mapping will no longer work efficiently--you can make them work with
> \a near-Herculean amount of carefully programming.
>
> Or you can look at the problem from a modern viewpoint and fix the
> model so the above is manifest.
>

Presumably, only the actual "bare metal" layer has an actual
hardware-level interrupt table, and all of the "guest" tables are faked
in software?...

Much like with MMU:
Only the base level needs to actually handle TLB miss events, and
everything else (nested translation, etc), can be left to software
emulation.

>> If anything, it is a little simpler than the mechanism used on some
>> 8-bit systems, which would have needed a mechanism to push these
>> values to the stack, and restore them from the stack.
>
> Do you think you mechanism would work "well" with 1024 cores in your
> system ??
>

Number of cores should not matter that much.

Presumably, each core gets its own ISR stack, which should not have any
reason to need to interact with each other.

For extra speed, maybe the ISR stacks could be mapped to some sort of
core-local SRAM. This hasn't been done yet though.

Idea here being probably the SRAM region could have a special address
range, and any access to this region would be invisible to any other
cores (and it need not need have backing in external RAM).

One could maybe debate the cost of giving each core 4K or 8K of
dedicated local SRAM though merely for "slightly faster interrupt handling".

>> Having side-channels that allow these values to "magically appear" in
>> certain SPRs is at least simpler, though the cost of the logic itself
>> could be more up for debate.
>
> Once you have an FMAC FPU none of the interrupt logic adds any area
> to any core.
>

I don't have conventional FMA because it would have had too much cost
and latency.

Did experimentally add a "double rounded" FMAC that basically allows
gluing the FMUL and FADD units together, with a timing of roughly 12
clock cycles (non-pipelined).

No SIMD MAC operations mostly because this would also need too much
latency (can't really shoe-horn this into 3 cycles). Similar reasoning
to why the SIMD ops are hard-wired for truncate rounding.

>>> Of course, the System/360 was able to solve this problem, so it's not
>>> intractable. But the fact that the System/360 solved it by saving all
>>> sixteen general registers, and then loading them from an area in memory
>>> allocated to that interrupt type, is what fooled me into thinking I
>>> would need to automatically save _everything_. It didn't save the
>>> floating-point registers - software did, if the need was to move to
>>> a different user's program, and saving the state in two separate pieces
>>> by two different parts of the OS did not cause hopeless confusion.
>>>
>
>> For ISR convenience, it would make sense to have, say, two SPR's or
>> CR's designated for ISR use to squirrel off values from GPRs to make
>> the prolog/epilog easier. Had considered this, but not done so (in
>> this case, first thing the ISR does is save a few registers to the ISR
>> stack to free them up to get the rest of the registers saved "more
>> properly", then has to do a secondary reload to get these registers
>> back into the correct place).
>
> Or, you could take the point of view that your architecture makes context
> switching easy (like 1 instruction from application 1 to application 2)
> and when you do this the rest of the model pretty much drops in for free.
>

This would cost well more, on the hardware side, than having two
non-specialized CRs and being like "ISR's are allowed to stomp these at
will, nothing else may use them".

>> Assuming interrupts aren't too common, then it isn't a huge issue, and
>> seemingly a majority of the clock-cycles spent on interrupt entry
>> mostly have to do with L1 misses (since typically pretty much nothing
>> the ISR touches is in the L1 cache; and in my implementation, ISR's
>> may not share L1 cache lines with non-ISR code; so basically it is an
>> architecturally required "L1 miss" storm).
>
> The fewer cycles before raising the interrupt at the device, and the
> servicing of the interrupt by ISR (prior to scheduling a SoftIRQ/DPC)
> is the key number. All these little pieces of state that are obtained
> 1 at a time by running code not in the ICache, along with the manipulations
> on the TLBs, ... get in the way of your goal.
>

Possibly...

Though, as of yet, I don't have any hardware interrupts either (apart
from the timer IRQ). Pretty much all of the IO at present is polling IO.

Granted, it is possible that it would not scale well to do a full
featured system with exclusively polling IO.

Some other tasks can be handled with the microsecond timer and a loop.

Say:
//void DelayUsec(int usec);
DelayUsec:
CPIUD 30
ADD R4, R0, R6
.L0:
CPUID 30
CMPQGT R0, R6
BT .L0
RTS
Which would create a certain amount of delay (in microseconds) relative
to when the function is called.

>> Only real way to avoid a lot of the L1 misses would be to have
>> multiple sets of banked registers or similar, but, this is not cheap
>> for the hardware... Similarly, the ISR would need to do as little, and
>> touch as little memory, as is possible to perform its task.
>
> You can read up thread-state from DRAM and continue what you are working
> on until they arrive, and when they arrive, you ship out the old values
> as if the core state was a cache in its own right. Thus, you continue to
> make progress on the current thread until you have the state needed to
> run the ISR thread and when it arrives you have everything you need to
> proceed. ...
>

Possibly, if the core were more advanced than a naive strictly-in-order
design...

Or, some way of handling memory other than stalling the pipeline
whenever the L1 cache misses.

But, yeah, for a more advanced system, could maybe justify using a
different interrupt-handler mechanism (and accept that possibly kernel
level code may not be entirely binary compatible between the ISA variants).

>>> John Savard

Re: Interrupts on the Concertina II

<55df2c2e4662c064fd9eb8f31c8783b7@www.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=37011&group=comp.arch#37011

  copy link   Newsgroups: comp.arch
Date: Mon, 22 Jan 2024 01:22:53 +0000
Subject: Re: Interrupts on the Concertina II
From: mitchalsup@aol.com (MitchAlsup1)
Newsgroups: comp.arch
X-Rslight-Site: $2y$10$30epTR4IX5.hrbTO2MlodOgKqVQBuHUtlpLEvoEH9GnQyvbW.K//S
X-Rslight-Posting-User: ac58ceb75ea22753186dae54d967fed894c3dce8
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
User-Agent: Rocksolid Light
References: <uo930v$24cq0$1@dont-email.me> <xTWpN.140322$yEgf.868@fx09.iad> <uoh4t9$3pht2$2@dont-email.me> <uojugt$buth$1@dont-email.me> <ff86faba91c3898f808cce78672bb058@www.novabbs.org> <uoka6h$dlog$1@dont-email.me>
Organization: Rocksolid Light
Message-ID: <55df2c2e4662c064fd9eb8f31c8783b7@www.novabbs.org>
 by: MitchAlsup1 - Mon, 22 Jan 2024 01:22 UTC

BGB wrote:

> On 1/21/2024 3:18 PM, MitchAlsup1 wrote:
>> BGB wrote:
>>
>>> On 1/20/2024 12:54 PM, Quadibloc wrote:
>>>> On Wed, 17 Jan 2024 15:35:56 -0500, EricP wrote:
>>>>
>>>> So one can't just have an interrupt behave like on an 8-bit
>>>> microprocessor,
>>>> saving only the program counter and the status bits, and leaving any
>>>> registers to be saved by software. At least some of the general
>>>> registers
>>>> have to be saved, and set up with new starting values, for the interrupt
>>>> routine to be able to save anything else, if need be.
>>>>
>>
>>> IIRC, saving off PC, some flags bits, swapping the stack registers,
>>> and doing a computed branch relative to a control register (via
>>> bit-slicing, *). This is effectively the interrupt mechanism I am
>>> using on a 64-bit ISA.
>>
>> And sounds like the interrupt mechanism for an 8-bit µprocessor...
>>

> It was partly a simplification of the design from the SH-4, which was a
> 32-bit CPU mostly used in embedded systems (and in the Sega Dreamcast...).

> Though, the SH-4 did bank out half the registers, which was a feature
> that ended up being dropped for cost-saving reasons.

>>> *: For a table that is generally one-off in the kernel or similar, it
>>> doesn't ask much to mandate that it has a certain alignment. And if
>>> the required alignment is larger than the size of the table, you have
>>> just saved yourself needing an adder...
>>
>> In a modern system where you have several HyperVisors and a multiplicity
>> of GuestOSs, a single interrupt table is unworkable looking forward.
>> What you want and need is every GuestOS to have its own table, and
>> every HyperVisor have its own table, some kind of routing mechanism to
>> route device interrupts to the correct table, and inform appropriate
>> cores of raised and enabled interrupts. All these tables have to be
>> concurrently available continuously and simultaneously. The old fixed
>> mapping will no longer work efficiently--you can make them work with
>> \a near-Herculean amount of carefully programming.
>>
>> Or you can look at the problem from a modern viewpoint and fix the
>> model so the above is manifest.
>>

> Presumably, only the actual "bare metal" layer has an actual
> hardware-level interrupt table, and all of the "guest" tables are faked
> in software?...

> Much like with MMU:
> Only the base level needs to actually handle TLB miss events, and
> everything else (nested translation, etc), can be left to software
> emulation.

Name a single ISA that fakes the TLB ?? (and has an MMU)

>>> If anything, it is a little simpler than the mechanism used on some
>>> 8-bit systems, which would have needed a mechanism to push these
>>> values to the stack, and restore them from the stack.
>>
>> Do you think you mechanism would work "well" with 1024 cores in your
>> system ??
>>

> Number of cores should not matter that much.

Exactly !! but then try running 1024 cores under differing GuestOSs, and
HyperVisors under one set of system-wide Tables !!

> Presumably, each core gets its own ISR stack, which should not have any
> reason to need to interact with each other.

I presume an interrupt can be serviced by any number of cores.
I presume that there are a vast number of devices. Each device assigned
to a few GuestOSs.
I presume the core that services the interrupt (ISR) is running the same
GuestOS under the same HyperVisor that initiated the device.
I presume the core that services the interrupt was of the lowest priority
of all the cores then running that GuestOS.
I presume the core that services the interrupt wasted no time in doing so.

And the GuestOS decides on how its ISR stack is {formatted, allocated, used,
serviced, ...} which can be different for each GuestOS.

> For extra speed, maybe the ISR stacks could be mapped to some sort of
> core-local SRAM. This hasn't been done yet though.

Caches either work or they don't.

Wasting cycles fetching instructions, translations, and data are genuine
overhead that can be avoided if one treats thread-state as a cache.

If the interrupt occurs often enough to mater, its instructions, data,
and translations will be in the cache hierarchy.

HW that knows what it is doing can start fetching these things even
BEFORE it can execute the first instruction on behalf of the interrupt
dispatcher. SW can NEVER do any of this prior to starting to run instr.

> Idea here being probably the SRAM region could have a special address
> range, and any access to this region would be invisible to any other
> cores (and it need not need have backing in external RAM).

> One could maybe debate the cost of giving each core 4K or 8K of
> dedicated local SRAM though merely for "slightly faster interrupt handling".

Yech: end of debate.....

>>> Having side-channels that allow these values to "magically appear" in
>>> certain SPRs is at least simpler, though the cost of the logic itself
>>> could be more up for debate.
>>
>> Once you have an FMAC FPU none of the interrupt logic adds any area
>> to any core.
>>

> I don't have conventional FMA because it would have had too much cost
> and latency.

Because you are measuring from the wrong implementation technology,
using macros ill suited to the problem at hand.

>>> For ISR convenience, it would make sense to have, say, two SPR's or
>>> CR's designated for ISR use to squirrel off values from GPRs to make
>>> the prolog/epilog easier. Had considered this, but not done so (in
>>> this case, first thing the ISR does is save a few registers to the ISR
>>> stack to free them up to get the rest of the registers saved "more
>>> properly", then has to do a secondary reload to get these registers
>>> back into the correct place).
>>
>> Or, you could take the point of view that your architecture makes context
>> switching easy (like 1 instruction from application 1 to application 2)
>> and when you do this the rest of the model pretty much drops in for free.
>>

> This would cost well more, on the hardware side, than having two
> non-specialized CRs and being like "ISR's are allowed to stomp these at
> will, nothing else may use them".

The sequencer is surprisingly small. Everything else already exists and
is just waiting around for a signal to capture this or emit that.

> Some other tasks can be handled with the microsecond timer and a loop.

> Say:
> //void DelayUsec(int usec);
> DelayUsec:
> CPIUD 30
> ADD R4, R0, R6
> .L0:
> CPUID 30
> CMPQGT R0, R6
> BT .L0
> RTS
> Which would create a certain amount of delay (in microseconds) relative
> to when the function is called.

CPUID n Opteron's time frame took 200-600 cycles. Do you really want to
talk to your timer with those kinds of delay ??

Pages:123
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor