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 Tue, Feb 26, 2019 at 01:59:42PM +0100, Rhialto wrote:
> On Mon 25 Feb 2019 at 18:10:20 +0000, Eduardo Horvath wrote:
> > I'd do something like:
> > 
> > uint64_t ufetch_64(const uint64_t *uaddr, int *errp);
> > 
> > where *errp needs to be initialized to zero and is set on fault so you can 
> > do:
> > 
> > 	int err = 0;
> > 	long hisflags = ufetch_64(flag1p, &err) | ufetch_64(flag2p, &err);
> > 
> > 	if (err) return EFAULT;
> > 	
> > 	do_something(hisflags);
> 
> I like this, because it swaps the cost of the value that is always
> needed (which was expensive) versus the one that isn't expected often
> (the error case, was cheap).

Huh? The code always has to access err to work correctly. You don't save
anything.

Joerg


Home | Main Index | Thread Index | Old Index