lgtm

nice analysis. sickly yours,

        - Dan C.


On Tue, Nov 8, 2016 at 11:19 AM, Barret Rhoden <[email protected]> wrote:

> The lock addq is accessing 8 bytes, but we only need to access one byte.
> Accessing 8 bytes could span a cacheline boundary, which it does currently.
> Doing so causes two cache misses!
>
> Signed-off-by: Barret Rhoden <[email protected]>
> ---
>  user/parlib/x86/vcore.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/user/parlib/x86/vcore.c b/user/parlib/x86/vcore.c
> index 3be41ae91951..5a4e8ab05b54 100644
> --- a/user/parlib/x86/vcore.c
> +++ b/user/parlib/x86/vcore.c
> @@ -117,7 +117,7 @@ static void pop_hw_tf(struct hw_trapframe *tf,
> uint32_t vcoreid)
>                                   /* Need a wrmb() here so the write of
> enable_notif can't pass
>                                    * the read of notif_pending (racing
> with a potential
>                                    * cross-core call with proc_notify()).
> */
> -                                 "lock addq $0, (%%rdi);" /* LOCK is a
> CPU mb() */
> +                                 "lock addb $0, (%%rdi);" /* LOCK is a
> CPU mb() */
>                                   /* From here down, we can get
> interrupted and restarted */
>                       "popq %%rdi;           " /* get notif_pending status
> loc */
>                       "testb $0x01, (%%rdi); " /* test if a notif is
> pending */
> @@ -173,7 +173,7 @@ static void pop_sw_tf(struct sw_trapframe *sw_tf,
> uint32_t vcoreid)
>                       /* Need a wrmb() here so the write of enable_notif
> can't pass
>                        * the read of notif_pending (racing with a potential
>                        * cross-core call with proc_notify()). */
> -                     "lock addq $0, (%2);   " /* LOCK is a CPU mb() */
> +                     "lock addb $0, (%2);   " /* LOCK is a CPU mb() */
>                       /* From here down, we can get interrupted and
> restarted */
>                       "testb $0x01, (%3);    " /* test if a notif is
> pending */
>                       "jz 1f;                " /* if not pending, skip
> syscall */
> --
> 2.8.0.rc3.226.g39d4020
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to