9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] non-interruptible temporary: why do we care?
@ 2021-01-04  3:32 ori
  2021-06-16 20:23 ` unobe
  0 siblings, 1 reply; 10+ messages in thread
From: ori @ 2021-01-04  3:32 UTC (permalink / raw)
  To: 9fans

Our compilers will sometimes produce a warning about
a non-interruptible temporary:

        #include <u.h>
        #include <libc.h>
        void
        f(vlong a)
        {
                vlong x, y, z;
                x = y = z = a;
        }

        cpu% 5c -w test.c
        warning: /fd/0:7 non-interruptable temporary
        warning: /fd/0:7 non-interruptable temporary

I know this means that the intermediate values
cannot be assigned atomically, but I don't see
why this rates a warning. From what I understand,
the uninterruptability of the temporaries should
be unobservable as long as our note handlers
save and restore registers correctly.

The only case I can think of is that a note
handler may see "tearing" of a register, but
that doesn't require a non-interruptible
temporary -- this kind of code will suffice:

        vlong x;
        int
        use_x(){ return x; }
        void
        main(void)
        {
                atnotify(use_x, 1);
                while(1)
                        x++;
        }

Why do we warn about non-interruptible
temporaries? What issues am I missing?

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-M4d085665c267ba8bfe227bbf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] non-interruptible temporary: why do we care?
  2021-01-04  3:32 [9fans] non-interruptible temporary: why do we care? ori
@ 2021-06-16 20:23 ` unobe
  2021-06-16 20:28   ` ori
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: unobe @ 2021-06-16 20:23 UTC (permalink / raw)
  To: 9fans

Quoth ori@eigenstate.org:
> Our compilers will sometimes produce a warning about
> a non-interruptible temporary:
> ...
> Why do we warn about non-interruptible
> temporaries? What issues am I missing?

Silence to this question means no one knows, right?


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-Ma99496ee99351822b7971771
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] non-interruptible temporary: why do we care?
  2021-06-16 20:23 ` unobe
@ 2021-06-16 20:28   ` ori
  2021-06-17 19:32     ` Charles Forsyth
  2021-06-16 21:10   ` Anthony Martin
  2021-06-20 14:53   ` [9fans] help Spock via 9fans
  2 siblings, 1 reply; 10+ messages in thread
From: ori @ 2021-06-16 20:28 UTC (permalink / raw)
  To: 9fans

Quoth unobe@cpan.org:
> Quoth ori@eigenstate.org:
> > Our compilers will sometimes produce a warning about
> > a non-interruptible temporary:
> > ...
> > Why do we warn about non-interruptible
> > temporaries? What issues am I missing?
> 
> Silence to this question means no one knows, right?
> 

I pinged Charles off list and got a response -- it means
we're falling into the rathole; in other words, we're
accessing a global variable.

The right thing to do (IMO) is make the compiler allocate
on the stack, and then the warning would be unneded.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-Ma608800db7356d10a02c4b44
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] non-interruptible temporary: why do we care?
  2021-06-16 20:23 ` unobe
  2021-06-16 20:28   ` ori
@ 2021-06-16 21:10   ` Anthony Martin
  2021-06-16 21:28     ` unobe
  2021-06-20 14:53   ` [9fans] help Spock via 9fans
  2 siblings, 1 reply; 10+ messages in thread
From: Anthony Martin @ 2021-06-16 21:10 UTC (permalink / raw)
  To: 9fans

unobe@cpan.org once said:
> Quoth ori@eigenstate.org:
> > Why do we warn about non-interruptible
> > temporaries? What issues am I missing?
>
> Silence to this question means no one knows, right?

There is nothing new under the sun.

        Date: Mon, 4 Apr 2005 14:10:20 -0400
        From: Russ Cox <russcox@gmail.com>
        To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
        Subject: Re: [9fans] 'non-interruptable temporary' warning
        Message-ID: <ee9e417a0504041110596cc301@mail.gmail.com>

        the compiler is warning you against its own laziness.
        in this case it is using a global temporary to hold the
        intermediate value of (lba = f->lba) while converting
        it to uchar.  if you had another thread running through
        this code it would use the same temporary.

        [...]

Cheers,
  Anthony

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-Ma5f11ad84f13cd81ba0c8c85
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] non-interruptible temporary: why do we care?
  2021-06-16 21:10   ` Anthony Martin
@ 2021-06-16 21:28     ` unobe
  0 siblings, 0 replies; 10+ messages in thread
From: unobe @ 2021-06-16 21:28 UTC (permalink / raw)
  To: 9fans

Quoth Anthony Martin <ality@pbrane.org>:
> There is nothing new under the sun.
> 
>         Date: Mon, 4 Apr 2005 14:10:20 -0400
>         From: Russ Cox <russcox@gmail.com>
>         To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
>         Subject: Re: [9fans] 'non-interruptable temporary' warning
>         Message-ID: <ee9e417a0504041110596cc301@mail.gmail.com>
> 
>         the compiler is warning you against its own laziness.
>         in this case it is using a global temporary to hold the
>         intermediate value of (lba = f->lba) while converting
>         it to uchar.  if you had another thread running through
>         this code it would use the same temporary.
> 
>         [...]
> 
> Cheers,
>   Anthony

Thanks for the quotation, Anthony.  I had used
9fans.topicbox.com/groups/9fans to search 'non-interruptible', not
'non-interruptable': I should have searched the actual error.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-M69e2bbedbc7f9cc31ede7ec0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] non-interruptible temporary: why do we care?
  2021-06-16 20:28   ` ori
@ 2021-06-17 19:32     ` Charles Forsyth
  0 siblings, 0 replies; 10+ messages in thread
From: Charles Forsyth @ 2021-06-17 19:32 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

yes, I'm not sure why it doesn't do that, but probably if I try to add that
code I'll soon find out!

On Wed, Jun 16, 2021 at 9:29 PM <ori@eigenstate.org> wrote:

> Quoth unobe@cpan.org:
> > Quoth ori@eigenstate.org:
> > > Our compilers will sometimes produce a warning about
> > > a non-interruptible temporary:
> > > ...
> > > Why do we warn about non-interruptible
> > > temporaries? What issues am I missing?
> >
> > Silence to this question means no one knows, right?
> >
> 
> I pinged Charles off list and got a response -- it means
> we're falling into the rathole; in other words, we're
> accessing a global variable.
> 
> The right thing to do (IMO) is make the compiler allocate
> on the stack, and then the warning would be unneded.
> 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-M8efb875683ddcb305946ecdd
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2430 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [9fans] help
  2021-06-16 20:23 ` unobe
  2021-06-16 20:28   ` ori
  2021-06-16 21:10   ` Anthony Martin
@ 2021-06-20 14:53   ` Spock via 9fans
  2021-06-20 15:32     ` Marshall Conover
  2 siblings, 1 reply; 10+ messages in thread
From: Spock via 9fans @ 2021-06-20 14:53 UTC (permalink / raw)
  To: 9fans


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-M8a03df73d1ccfb90d6667fe3
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] help
  2021-06-20 14:53   ` [9fans] help Spock via 9fans
@ 2021-06-20 15:32     ` Marshall Conover
  2021-06-20 18:46       ` U Cirello
  2021-06-20 21:14       ` Ethan Gardener
  0 siblings, 2 replies; 10+ messages in thread
From: Marshall Conover @ 2021-06-20 15:32 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

The most recent humpback whale sighting I could find is this:
https://www.stuff.co.nz/environment/125480446/humpback-whales-put-on-spectacular-show-in-sounds

Live long and prosper,

Marshall

On Sun, Jun 20, 2021 at 10:55 AM Spock via 9fans <9fans@9fans.net> wrote:



-- 
Have a good day,

Marshall Conover

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-M97f0a8e6e9023e7290decde7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2003 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] help
  2021-06-20 15:32     ` Marshall Conover
@ 2021-06-20 18:46       ` U Cirello
  2021-06-20 21:14       ` Ethan Gardener
  1 sibling, 0 replies; 10+ messages in thread
From: U Cirello @ 2021-06-20 18:46 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

that's why I don't unsub 9fans

On Sun, Jun 20, 2021 at 8:33 AM Marshall Conover <marzhall.o@gmail.com>
wrote:

> The most recent humpback whale sighting I could find is this:
> https://www.stuff.co.nz/environment/125480446/humpback-whales-put-on-spectacular-show-in-sounds
>
> Live long and prosper,
>
> Marshall
>
> On Sun, Jun 20, 2021 at 10:55 AM Spock via 9fans <9fans@9fans.net> wrote:
>
>
>
> --
> Have a good day,
>
> Marshall Conover
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-M97f0a8e6e9023e7290decde7>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-M09890359e8b351806e54de1d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2405 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] help
  2021-06-20 15:32     ` Marshall Conover
  2021-06-20 18:46       ` U Cirello
@ 2021-06-20 21:14       ` Ethan Gardener
  1 sibling, 0 replies; 10+ messages in thread
From: Ethan Gardener @ 2021-06-20 21:14 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

But where are the nuklear wessels?

On Sun, Jun 20, 2021, at 4:32 PM, Marshall Conover wrote:
> The most recent humpback whale sighting I could find is this: https://www.stuff.co.nz/environment/125480446/humpback-whales-put-on-spectacular-show-in-sounds
> 
> Live long and prosper,
> 
> Marshall
> 
> On Sun, Jun 20, 2021 at 10:55 AM Spock via 9fans <9fans@9fans.net> wrote:
> 
> 
> -- 
> Have a good day,
> 
> Marshall Conover
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions <https://9fans.topicbox.com/groups/9fans> + participants <https://9fans.topicbox.com/groups/9fans/members> + delivery options <https://9fans.topicbox.com/groups/9fans/subscription> Permalink <https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-M97f0a8e6e9023e7290decde7>
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T1bf00692daa5f082-Mc9658bb52fdb7e4a58dff080
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2661 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-20 21:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04  3:32 [9fans] non-interruptible temporary: why do we care? ori
2021-06-16 20:23 ` unobe
2021-06-16 20:28   ` ori
2021-06-17 19:32     ` Charles Forsyth
2021-06-16 21:10   ` Anthony Martin
2021-06-16 21:28     ` unobe
2021-06-20 14:53   ` [9fans] help Spock via 9fans
2021-06-20 15:32     ` Marshall Conover
2021-06-20 18:46       ` U Cirello
2021-06-20 21:14       ` Ethan Gardener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).