tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: RFC: New userspace fetch/store API
On Mon, 25 Feb 2019 at 11:35, Eduardo Horvath <eeh%netbsd.org@localhost> wrote:
>
> On Sat, 23 Feb 2019, Jason Thorpe wrote:
>
> > int ufetch_8(const uint8_t *uaddr, uint8_t *valp);
> > int ufetch_16(const uint16_t *uaddr, uint16_t *valp);
> > int ufetch_32(const uint32_t *uaddr, uint32_t *valp);
> > #ifdef _LP64
> > int ufetch_64(const uint64_t *uaddr, uint64_t *valp);
> > #endif
>
> etc.
>
> I'd prefer to return the fetched value and have an out of band error
> check.
>
> With this API the routine does a userland load, then a store into kernel
> memory. Then the kernel needs to reload that value. On modern CPUs
> memory accesses tend to be sloooooow.
So the out-of-band error check becomes the slooooow memory write?
I don't see it as a problem as the data would presumably be written to
the write-back cached's stack (besides, if the function is short, LTO
will eliminate it).
FWIW, I suspect the most "efficient" way to return the value+error as
a struct - ABIs would return the pair in registers or, failing that,
pass a single stack address - but I don't think this interface should
go there.
Home |
Main Index |
Thread Index |
Old Index