* Re: User applications
@ 2001-01-08 14:14 ` Kevin D. Kissell
0 siblings, 0 replies; 30+ messages in thread
From: Kevin D. Kissell @ 2001-01-08 14:14 UTC (permalink / raw)
To: linux-mips, Carsten Langgaard, Michael Shmulevich
> > When a new user process is started will its user space be cleared by the
> > kernel or is there a potential leak from an older user process ?
>
> Usually it is defied by the loader. If the data section contents is set to
> LOAD, then the contents of the section will be loaded from disk (no leak),
> if not -- whatever values left i nmemory will be there, or exactly, the
> virtual page of some other proccess that was swapped out or ended.
Note that what you are describing here is the "exec()" behavior.
I believe Carsten was talking about what happens on a "fork()".
> > What about the registers values, are they cleared for each new user
> > application or will it simply contain the current value it got when the
> > user application is started ?
>
> It depends on the context switch algorithm of the processor, I think.
On a fork() (or presumably clone()) operation, the set of registers
is copied. Loading a new program ("exec()") should set up the
registers that point to the base of the new stack, the environment,
etc. Historically, it's up to the runtime startup code ("crt0" in old
Unix systems) to do any other register initialization.
> > How can you flush the data and instruction cashes from a user
> > application ?
> >
>
> As far as I understand, ASID must take care of it. It contains unique IDs
> per process virtual space, so that even
> though virtual addresses may be found in TLB, their ASID will be
different,
> causing TLB miss and probably page fault.
That won't necessarily affect the caches, though. While it
would be possible to do so, I don't believe any existing
MIPS implementations include ASID in the cache tags.
Hits are determined by an address match, period.
Back in the Ancient Old Days of System V, every architecture
had an architecture-specific system call entry, the first parameter
of which expressed what needed to be done. Do we have
such a thing in Linux? That would be the logical place to
things like cache flush and the atomic operations that were
being discussed here a couple of weeks ago.
Regards,
Kevin K.
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-08 14:14 ` Kevin D. Kissell
(?)
@ 2001-01-08 14:16 ` Carsten Langgaard
2001-01-08 16:03 ` Ralf Baechle
-1 siblings, 1 reply; 30+ messages in thread
From: Carsten Langgaard @ 2001-01-08 14:16 UTC (permalink / raw)
To: Kevin D. Kissell; +Cc: linux-mips, Michael Shmulevich
"Kevin D. Kissell" wrote:
> > > When a new user process is started will its user space be cleared by the
> > > kernel or is there a potential leak from an older user process ?
> >
> > Usually it is defied by the loader. If the data section contents is set to
> > LOAD, then the contents of the section will be loaded from disk (no leak),
> > if not -- whatever values left i nmemory will be there, or exactly, the
> > virtual page of some other proccess that was swapped out or ended.
>
> Note that what you are describing here is the "exec()" behavior.
> I believe Carsten was talking about what happens on a "fork()".
>
> > > What about the registers values, are they cleared for each new user
> > > application or will it simply contain the current value it got when the
> > > user application is started ?
> >
> > It depends on the context switch algorithm of the processor, I think.
>
> On a fork() (or presumably clone()) operation, the set of registers
> is copied. Loading a new program ("exec()") should set up the
> registers that point to the base of the new stack, the environment,
> etc. Historically, it's up to the runtime startup code ("crt0" in old
> Unix systems) to do any other register initialization.
>
> > > How can you flush the data and instruction cashes from a user
> > > application ?
> > >
> >
> > As far as I understand, ASID must take care of it. It contains unique IDs
> > per process virtual space, so that even
> > though virtual addresses may be found in TLB, their ASID will be
> different,
> > causing TLB miss and probably page fault.
>
> That won't necessarily affect the caches, though. While it
> would be possible to do so, I don't believe any existing
> MIPS implementations include ASID in the cache tags.
> Hits are determined by an address match, period.
>
> Back in the Ancient Old Days of System V, every architecture
> had an architecture-specific system call entry, the first parameter
> of which expressed what needed to be done. Do we have
> such a thing in Linux? That would be the logical place to
> things like cache flush and the atomic operations that were
> being discussed here a couple of weeks ago.
I think I just found it.
The system call is sysmips(FLUSH_CACHE).
>
> Regards,
>
> Kevin K.
--
_ _ ____ ___ Carsten Langgaard Mailto:carstenl@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527
| \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555
TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556
Denmark http://www.mips.com
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-08 14:16 ` Carsten Langgaard
@ 2001-01-08 16:03 ` Ralf Baechle
0 siblings, 0 replies; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 16:03 UTC (permalink / raw)
To: Carsten Langgaard; +Cc: Kevin D. Kissell, linux-mips, Michael Shmulevich
On Mon, Jan 08, 2001 at 03:16:16PM +0100, Carsten Langgaard wrote:
> I think I just found it.
> The system call is sysmips(FLUSH_CACHE).
Don't. Sysmips(FLUSH_CACHE, ...) only allows very coarse flush operation,
that is flushing all caches. The whole sysmips(2) call exists in Linux
only as a stone age compatibility thing.
Ralf
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 14:14 ` Kevin D. Kissell
(?)
(?)
@ 2001-01-08 15:07 ` Maciej W. Rozycki
2001-01-08 15:21 ` Kevin D. Kissell
2001-01-08 16:05 ` Ralf Baechle
-1 siblings, 2 replies; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 15:07 UTC (permalink / raw)
To: Kevin D. Kissell; +Cc: linux-mips, Carsten Langgaard, Michael Shmulevich
On Mon, 8 Jan 2001, Kevin D. Kissell wrote:
> Back in the Ancient Old Days of System V, every architecture
> had an architecture-specific system call entry, the first parameter
> of which expressed what needed to be done. Do we have
> such a thing in Linux? That would be the logical place to
> things like cache flush and the atomic operations that were
> being discussed here a couple of weeks ago.
The only case caches need to be synchronized is modifying some code. The
ptrace syscall does it automatically for text writes -- it's needed and
used by gdb to set breakpoints, for example. For other code there is
cacheflush() which allows you to flush a cache range relevant to a given
virtual address (I see it's not implemented very well at the moment).
Obviously, you don't want to allow unprivileged users to flush caches as
a whole as it could lead to a DoS.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
@ 2001-01-08 15:21 ` Kevin D. Kissell
0 siblings, 0 replies; 30+ messages in thread
From: Kevin D. Kissell @ 2001-01-08 15:21 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: linux-mips, Carsten Langgaard, Michael Shmulevich
----- Original Message -----
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: "Kevin D. Kissell" <kevink@mips.com>
Cc: <linux-mips@oss.sgi.com>; "Carsten Langgaard" <carstenl@mips.com>;
"Michael Shmulevich" <michaels@jungo.com>
Sent: Monday, January 08, 2001 4:07 PM
Subject: Re: User applications
> On Mon, 8 Jan 2001, Kevin D. Kissell wrote:
>
> > Back in the Ancient Old Days of System V, every architecture
> > had an architecture-specific system call entry, the first parameter
> > of which expressed what needed to be done. Do we have
> > such a thing in Linux? That would be the logical place to
> > things like cache flush and the atomic operations that were
> > being discussed here a couple of weeks ago.
>
> The only case caches need to be synchronized is modifying some code.
Which just happens to be the case under discussion here.
>The ptrace syscall does it automatically for text writes -- it's needed
and
> used by gdb to set breakpoints, for example. For other code there is
> cacheflush() which allows you to flush a cache range relevant to a given
> virtual address (I see it's not implemented very well at the moment).
>
> Obviously, you don't want to allow unprivileged users to flush caches as
> a whole as it could lead to a DoS.
By that logic, we should not allow users to allocate more virtual
memory than there is physical memory in the system! A pathological
swap program is arguably far a far worse denial of service attack
than flushing the caches - so long as by "flush" we mean invalidate
with writeback (on copyback caches), of course.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
@ 2001-01-08 15:21 ` Kevin D. Kissell
0 siblings, 0 replies; 30+ messages in thread
From: Kevin D. Kissell @ 2001-01-08 15:21 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: linux-mips, Carsten Langgaard, Michael Shmulevich
----- Original Message -----
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: "Kevin D. Kissell" <kevink@mips.com>
Cc: <linux-mips@oss.sgi.com>; "Carsten Langgaard" <carstenl@mips.com>;
"Michael Shmulevich" <michaels@jungo.com>
Sent: Monday, January 08, 2001 4:07 PM
Subject: Re: User applications
> On Mon, 8 Jan 2001, Kevin D. Kissell wrote:
>
> > Back in the Ancient Old Days of System V, every architecture
> > had an architecture-specific system call entry, the first parameter
> > of which expressed what needed to be done. Do we have
> > such a thing in Linux? That would be the logical place to
> > things like cache flush and the atomic operations that were
> > being discussed here a couple of weeks ago.
>
> The only case caches need to be synchronized is modifying some code.
Which just happens to be the case under discussion here.
>The ptrace syscall does it automatically for text writes -- it's needed
and
> used by gdb to set breakpoints, for example. For other code there is
> cacheflush() which allows you to flush a cache range relevant to a given
> virtual address (I see it's not implemented very well at the moment).
>
> Obviously, you don't want to allow unprivileged users to flush caches as
> a whole as it could lead to a DoS.
By that logic, we should not allow users to allocate more virtual
memory than there is physical memory in the system! A pathological
swap program is arguably far a far worse denial of service attack
than flushing the caches - so long as by "flush" we mean invalidate
with writeback (on copyback caches), of course.
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 15:21 ` Kevin D. Kissell
(?)
@ 2001-01-08 15:40 ` Maciej W. Rozycki
2001-01-08 16:27 ` Ralf Baechle
-1 siblings, 1 reply; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 15:40 UTC (permalink / raw)
To: Kevin D. Kissell; +Cc: linux-mips, Carsten Langgaard, Michael Shmulevich
On Mon, 8 Jan 2001, Kevin D. Kissell wrote:
> > Obviously, you don't want to allow unprivileged users to flush caches as
> > a whole as it could lead to a DoS.
>
> By that logic, we should not allow users to allocate more virtual
> memory than there is physical memory in the system! A pathological
> swap program is arguably far a far worse denial of service attack
There are limits -- see `info setrlimit'. There is no way to prevent a
program from executing:
while (1) flush_cache_all();
though but the system's performance would suffer much. Remember there is
real world out there...
Which means sysmips(FLUSH_CACHE, ...) needs to be fixed or removed.
> than flushing the caches - so long as by "flush" we mean invalidate
> with writeback (on copyback caches), of course.
What's wrong with cacheflush(addr, count, which) that actually checks if
<addr; addr+count> lies within the caller's address space before
performing the flush and returns -EPERM otherwise? It would make the
caller crawl like a turtle if it wished to but it would leave other
processes alone.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 15:40 ` Maciej W. Rozycki
@ 2001-01-08 16:27 ` Ralf Baechle
2001-01-08 16:43 ` Maciej W. Rozycki
0 siblings, 1 reply; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 16:27 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Kevin D. Kissell, linux-mips, Carsten Langgaard,
Michael Shmulevich
On Mon, Jan 08, 2001 at 04:40:06PM +0100, Maciej W. Rozycki wrote:
> > than flushing the caches - so long as by "flush" we mean invalidate
> > with writeback (on copyback caches), of course.
>
> What's wrong with cacheflush(addr, count, which) that actually checks if
> <addr; addr+count> lies within the caller's address space before
> performing the flush and returns -EPERM otherwise? It would make the
> caller crawl like a turtle if it wished to but it would leave other
> processes alone.
cacheflush(2) actually is supposed to handle things that way.
Ralf
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:27 ` Ralf Baechle
@ 2001-01-08 16:43 ` Maciej W. Rozycki
2001-01-08 16:41 ` Ralf Baechle
0 siblings, 1 reply; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 16:43 UTC (permalink / raw)
To: Ralf Baechle
Cc: Kevin D. Kissell, linux-mips, Carsten Langgaard,
Michael Shmulevich
On Mon, 8 Jan 2001, Ralf Baechle wrote:
> > What's wrong with cacheflush(addr, count, which) that actually checks if
> > <addr; addr+count> lies within the caller's address space before
> > performing the flush and returns -EPERM otherwise? It would make the
> > caller crawl like a turtle if it wished to but it would leave other
> > processes alone.
>
> cacheflush(2) actually is supposed to handle things that way.
Didn't I write it clearly-enough? ;-)
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:43 ` Maciej W. Rozycki
@ 2001-01-08 16:41 ` Ralf Baechle
0 siblings, 0 replies; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 16:41 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Kevin D. Kissell, linux-mips, Carsten Langgaard,
Michael Shmulevich
On Mon, Jan 08, 2001 at 05:43:24PM +0100, Maciej W. Rozycki wrote:
> > > What's wrong with cacheflush(addr, count, which) that actually checks if
> > > <addr; addr+count> lies within the caller's address space before
> > > performing the flush and returns -EPERM otherwise? It would make the
> > > caller crawl like a turtle if it wished to but it would leave other
> > > processes alone.
> >
> > cacheflush(2) actually is supposed to handle things that way.
>
> Didn't I write it clearly-enough? ;-)
return -EOVERBLOODINCAFFEIN;
Ralf
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 15:07 ` Maciej W. Rozycki
2001-01-08 15:21 ` Kevin D. Kissell
@ 2001-01-08 16:05 ` Ralf Baechle
2001-01-08 16:23 ` Carsten Langgaard
2001-01-08 16:34 ` Maciej W. Rozycki
1 sibling, 2 replies; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 16:05 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Kevin D. Kissell, linux-mips, Carsten Langgaard,
Michael Shmulevich
On Mon, Jan 08, 2001 at 04:07:31PM +0100, Maciej W. Rozycki wrote:
> The only case caches need to be synchronized is modifying some code. The
> ptrace syscall does it automatically for text writes -- it's needed and
> used by gdb to set breakpoints, for example. For other code there is
> cacheflush() which allows you to flush a cache range relevant to a given
> virtual address (I see it's not implemented very well at the moment).
>
> Obviously, you don't want to allow unprivileged users to flush caches as
> a whole as it could lead to a DoS.
You obviously want to allow partial cache flushes or trampolines don't work
and flushing the entire cache can be constructed from that.
Ralf
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:05 ` Ralf Baechle
@ 2001-01-08 16:23 ` Carsten Langgaard
2001-01-08 16:30 ` Ralf Baechle
2001-01-08 16:40 ` Maciej W. Rozycki
2001-01-08 16:34 ` Maciej W. Rozycki
1 sibling, 2 replies; 30+ messages in thread
From: Carsten Langgaard @ 2001-01-08 16:23 UTC (permalink / raw)
To: Ralf Baechle
Cc: Maciej W. Rozycki, Kevin D. Kissell, linux-mips,
Michael Shmulevich
Ralf Baechle wrote:
> On Mon, Jan 08, 2001 at 04:07:31PM +0100, Maciej W. Rozycki wrote:
>
> > The only case caches need to be synchronized is modifying some code. The
> > ptrace syscall does it automatically for text writes -- it's needed and
> > used by gdb to set breakpoints, for example. For other code there is
> > cacheflush() which allows you to flush a cache range relevant to a given
> > virtual address (I see it's not implemented very well at the moment).
> >
> > Obviously, you don't want to allow unprivileged users to flush caches as
> > a whole as it could lead to a DoS.
>
> You obviously want to allow partial cache flushes or trampolines don't work
> and flushing the entire cache can be constructed from that.
>
What we need is a mechanism to partial invalidate the I-cache and a mechanism
to write-back and/or invalidate the D-cache.
/Carsten
--
_ _ ____ ___ Carsten Langgaard Mailto:carstenl@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527
| \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555
TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556
Denmark http://www.mips.com
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-08 16:23 ` Carsten Langgaard
@ 2001-01-08 16:30 ` Ralf Baechle
2001-01-08 16:50 ` Carsten Langgaard
2001-01-08 16:40 ` Maciej W. Rozycki
1 sibling, 1 reply; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 16:30 UTC (permalink / raw)
To: Carsten Langgaard
Cc: Ralf Baechle, Maciej W. Rozycki, Kevin D. Kissell, linux-mips,
Michael Shmulevich
On Mon, Jan 08, 2001 at 05:23:20PM +0100, Carsten Langgaard wrote:
> What we need is a mechanism to partial invalidate the I-cache and a mechanism
> to write-back and/or invalidate the D-cache.
There is this nice little man page which should even be installed on your
Linux/Inhell box:
CACHEFLUSH(2) Linux Programmer's Manual CACHEFLUSH(2)
NAME
cacheflush - flush contents of instruction and/or data
cache
SYNOPSIS
#include <asm/cachectl.h>
int cacheflush(char *addr, int nbytes, int cache);
DESCRIPTION
cacheflush flushes contents of indicated cache(s) for user
addresses in the range addr to (addr+nbytes-1). Cache may
be one of:
ICACHE Flush the instruction cache.
DCACHE Write back to memory and invalidate the affected
valid cache lines.
BCACHE Same as (ICACHE|DCACHE).
RETURN VALUE
cacheflush returns 0 on success or -1 on error. If errors
are detected, errno will indicate the error.
ERRORS
EINVAL cache parameter is not one of ICACHE, DCACHE, or
BCACHE.
EFAULT Some or all of the address range addr to
(addr+nbytes-1) is not accessible.
BUGS
The current implementation ignores the addr and nbytes
parameters. Therefore always the whole cache is flushed.
NOTE
This system call is only available on MIPS based systems.
It should not be used in programs intended to be portable.
Linux 2.0.32 27 June 95 1
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-08 16:30 ` Ralf Baechle
@ 2001-01-08 16:50 ` Carsten Langgaard
2001-01-08 17:56 ` Maciej W. Rozycki
0 siblings, 1 reply; 30+ messages in thread
From: Carsten Langgaard @ 2001-01-08 16:50 UTC (permalink / raw)
To: Ralf Baechle
Cc: Maciej W. Rozycki, Kevin D. Kissell, linux-mips,
Michael Shmulevich
Exactly that I need, but I don't think it is implemented properly for mips.
It simply flushes all the caches, no matter what options you gives it.
/Carsten
Ralf Baechle wrote:
> On Mon, Jan 08, 2001 at 05:23:20PM +0100, Carsten Langgaard wrote:
>
> > What we need is a mechanism to partial invalidate the I-cache and a mechanism
> > to write-back and/or invalidate the D-cache.
>
> There is this nice little man page which should even be installed on your
> Linux/Inhell box:
>
> CACHEFLUSH(2) Linux Programmer's Manual CACHEFLUSH(2)
>
> NAME
> cacheflush - flush contents of instruction and/or data
> cache
>
> SYNOPSIS
> #include <asm/cachectl.h>
>
> int cacheflush(char *addr, int nbytes, int cache);
>
> DESCRIPTION
> cacheflush flushes contents of indicated cache(s) for user
> addresses in the range addr to (addr+nbytes-1). Cache may
> be one of:
>
> ICACHE Flush the instruction cache.
>
> DCACHE Write back to memory and invalidate the affected
> valid cache lines.
>
> BCACHE Same as (ICACHE|DCACHE).
>
> RETURN VALUE
> cacheflush returns 0 on success or -1 on error. If errors
> are detected, errno will indicate the error.
>
> ERRORS
> EINVAL cache parameter is not one of ICACHE, DCACHE, or
> BCACHE.
>
> EFAULT Some or all of the address range addr to
> (addr+nbytes-1) is not accessible.
>
> BUGS
> The current implementation ignores the addr and nbytes
> parameters. Therefore always the whole cache is flushed.
>
> NOTE
> This system call is only available on MIPS based systems.
> It should not be used in programs intended to be portable.
>
> Linux 2.0.32 27 June 95 1
--
_ _ ____ ___ Carsten Langgaard Mailto:carstenl@mips.com
|\ /|||___)(___ MIPS Denmark Direct: +45 4486 5527
| \/ ||| ____) Lautrupvang 4B Switch: +45 4486 5555
TECHNOLOGIES 2750 Ballerup Fax...: +45 4486 5556
Denmark http://www.mips.com
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-08 16:50 ` Carsten Langgaard
@ 2001-01-08 17:56 ` Maciej W. Rozycki
0 siblings, 0 replies; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 17:56 UTC (permalink / raw)
To: Carsten Langgaard
Cc: Ralf Baechle, Kevin D. Kissell, linux-mips, Michael Shmulevich
On Mon, 8 Jan 2001, Carsten Langgaard wrote:
> Exactly that I need, but I don't think it is implemented properly for mips.
> It simply flushes all the caches, no matter what options you gives it.
Yep, it's just a limitation of the implementation. But it's the right
function and now that I know of the problem it goes to my to do list (but
processing of the list is not that fast these days, so anyone feel free to
do it oneself).
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:23 ` Carsten Langgaard
2001-01-08 16:30 ` Ralf Baechle
@ 2001-01-08 16:40 ` Maciej W. Rozycki
2001-01-08 17:42 ` Ralf Baechle
1 sibling, 1 reply; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 16:40 UTC (permalink / raw)
To: Carsten Langgaard
Cc: Ralf Baechle, Kevin D. Kissell, linux-mips, Michael Shmulevich
On Mon, 8 Jan 2001, Carsten Langgaard wrote:
> What we need is a mechanism to partial invalidate the I-cache and a mechanism
> to write-back and/or invalidate the D-cache.
What's wrong with the already mentioned cachectl?
$ mipsel-linux-objdump -T /usr/mipsel-linux/lib/libc-2.2.so | grep cachectl
00000000600ca0a0 w DF *ABS* 0000000000000000 GLIBC_2.0 cachectl
$ ls /usr/mipsel-linux/include/sys/cachectl.h
/usr/mipsel-linux/include/sys/cachectl.h
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:40 ` Maciej W. Rozycki
@ 2001-01-08 17:42 ` Ralf Baechle
2001-01-08 17:58 ` Maciej W. Rozycki
0 siblings, 1 reply; 30+ messages in thread
From: Ralf Baechle @ 2001-01-08 17:42 UTC (permalink / raw)
To: Maciej W. Rozycki
Cc: Carsten Langgaard, Kevin D. Kissell, linux-mips,
Michael Shmulevich
On Mon, Jan 08, 2001 at 05:40:23PM +0100, Maciej W. Rozycki wrote:
> > What we need is a mechanism to partial invalidate the I-cache and a mechanism
> > to write-back and/or invalidate the D-cache.
>
> What's wrong with the already mentioned cachectl?
>
> $ mipsel-linux-objdump -T /usr/mipsel-linux/lib/libc-2.2.so | grep cachectl
> 00000000600ca0a0 w DF *ABS* 0000000000000000 GLIBC_2.0 cachectl
> $ ls /usr/mipsel-linux/include/sys/cachectl.h
> /usr/mipsel-linux/include/sys/cachectl.h
cachectl(2) is a syscall that is manipulates the cachability of a memory
area. And not yet implemented ...
Ralf
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 17:42 ` Ralf Baechle
@ 2001-01-08 17:58 ` Maciej W. Rozycki
2001-01-09 11:49 ` Michael Shmulevich
0 siblings, 1 reply; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 17:58 UTC (permalink / raw)
To: Ralf Baechle
Cc: Carsten Langgaard, Kevin D. Kissell, linux-mips,
Michael Shmulevich
On Mon, 8 Jan 2001, Ralf Baechle wrote:
> > $ mipsel-linux-objdump -T /usr/mipsel-linux/lib/libc-2.2.so | grep cachectl
> > 00000000600ca0a0 w DF *ABS* 0000000000000000 GLIBC_2.0 cachectl
> > $ ls /usr/mipsel-linux/include/sys/cachectl.h
> > /usr/mipsel-linux/include/sys/cachectl.h
>
> cachectl(2) is a syscall that is manipulates the cachability of a memory
> area. And not yet implemented ...
s/cachectl$/cacheflush/, of course (but the header is still valid).
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 17:58 ` Maciej W. Rozycki
@ 2001-01-09 11:49 ` Michael Shmulevich
2001-01-09 12:15 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 30+ messages in thread
From: Michael Shmulevich @ 2001-01-09 11:49 UTC (permalink / raw)
To: Maciej W. Rozycki, linux-mips
As a side question, I would like to to know why exactly the CPU cache operations
are
promoted to the syscall status? What is the situation that a user in its program
would like
to call cacheflush() ? Unless, of course, he is doing DoS.
I can understand why we need this in kernel, for context switch, for example, but
as a syscall?...
Michael.
"Maciej W. Rozycki" wrote:
> On Mon, 8 Jan 2001, Ralf Baechle wrote:
>
> > > $ mipsel-linux-objdump -T /usr/mipsel-linux/lib/libc-2.2.so | grep cachectl
> > > 00000000600ca0a0 w DF *ABS* 0000000000000000 GLIBC_2.0 cachectl
> > > $ ls /usr/mipsel-linux/include/sys/cachectl.h
> > > /usr/mipsel-linux/include/sys/cachectl.h
> >
> > cachectl(2) is a syscall that is manipulates the cachability of a memory
> > area. And not yet implemented ...
>
> s/cachectl$/cacheflush/, of course (but the header is still valid).
>
> --
> + Maciej W. Rozycki, Technical University of Gdansk, Poland +
> +--------------------------------------------------------------+
> + e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
2001-01-09 11:49 ` Michael Shmulevich
@ 2001-01-09 12:15 ` Geert Uytterhoeven
2001-01-09 12:17 ` Alan Cox
2001-01-09 13:00 ` Maciej W. Rozycki
2 siblings, 0 replies; 30+ messages in thread
From: Geert Uytterhoeven @ 2001-01-09 12:15 UTC (permalink / raw)
To: Michael Shmulevich; +Cc: Maciej W. Rozycki, linux-mips
On Tue, 9 Jan 2001, Michael Shmulevich wrote:
> As a side question, I would like to to know why exactly the CPU cache operations
> are
> promoted to the syscall status? What is the situation that a user in its program
> would like
> to call cacheflush() ? Unless, of course, he is doing DoS.
>
> I can understand why we need this in kernel, for context switch, for example, but
> as a syscall?...
For trampolines. These are small pieces of code created on the stack, and
require flushing of the caches before they are excuted.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven ------------- Sony Software Development Center Europe (SDCE)
Geert.Uytterhoeven@sonycom.com ------------------- Sint-Stevens-Woluwestraat 55
Voice +32-2-7248626 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium
^ permalink raw reply [flat|nested] 30+ messages in thread* Re: User applications
@ 2001-01-09 12:17 ` Alan Cox
0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2001-01-09 12:17 UTC (permalink / raw)
To: Michael Shmulevich; +Cc: Maciej W. Rozycki, linux-mips
> promoted to the syscall status? What is the situation that a user in its program
> would like
> to call cacheflush() ? Unless, of course, he is doing DoS.
A cache flush is not a denial of service attack. Its no less effective than a
1Mb memcpy
> I can understand why we need this in kernel, for context switch, for example, but
> as a syscall?...
Self modifying code, dynamic compilation, glibc trampolines
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
@ 2001-01-09 12:17 ` Alan Cox
0 siblings, 0 replies; 30+ messages in thread
From: Alan Cox @ 2001-01-09 12:17 UTC (permalink / raw)
To: Michael Shmulevich; +Cc: Maciej W. Rozycki, linux-mips
> promoted to the syscall status? What is the situation that a user in its program
> would like
> to call cacheflush() ? Unless, of course, he is doing DoS.
A cache flush is not a denial of service attack. Its no less effective than a
1Mb memcpy
> I can understand why we need this in kernel, for context switch, for example, but
> as a syscall?...
Self modifying code, dynamic compilation, glibc trampolines
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-09 11:49 ` Michael Shmulevich
2001-01-09 12:15 ` Geert Uytterhoeven
2001-01-09 12:17 ` Alan Cox
@ 2001-01-09 13:00 ` Maciej W. Rozycki
2 siblings, 0 replies; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-09 13:00 UTC (permalink / raw)
To: Michael Shmulevich; +Cc: linux-mips
On Tue, 9 Jan 2001, Michael Shmulevich wrote:
> As a side question, I would like to to know why exactly the CPU cache operations
> are
> promoted to the syscall status? What is the situation that a user in its program
> would like
> to call cacheflush() ? Unless, of course, he is doing DoS.
Any software that modifes text needs it. For example the dynamic linker
or libdl.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: User applications
2001-01-08 16:05 ` Ralf Baechle
2001-01-08 16:23 ` Carsten Langgaard
@ 2001-01-08 16:34 ` Maciej W. Rozycki
1 sibling, 0 replies; 30+ messages in thread
From: Maciej W. Rozycki @ 2001-01-08 16:34 UTC (permalink / raw)
To: Ralf Baechle
Cc: Kevin D. Kissell, linux-mips, Carsten Langgaard,
Michael Shmulevich
On Mon, 8 Jan 2001, Ralf Baechle wrote:
> You obviously want to allow partial cache flushes or trampolines don't work
> and flushing the entire cache can be constructed from that.
It depends on the implementation. The current one obviously allows it.
;-)
I'm writing of the design.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
^ permalink raw reply [flat|nested] 30+ messages in thread