Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Add a membar_datadep_consumer() before dereferencin...



details:   https://anonhg.NetBSD.org/src/rev/beb51ea06742
branches:  trunk
changeset: 805740:beb51ea06742
user:      dennis <dennis%NetBSD.org@localhost>
date:      Fri Jan 16 20:10:25 2015 +0000

description:
Add a membar_datadep_consumer() before dereferencing the pointer
to a cache entry in cache_lookup_entry().  The entries are being
added to the list it is looking at without mutually-exclusive locking,
so this is necessary to keep some Alphas from seeing stale data
when the pointer is newly-updated.

XXX this is doing lockless adds to a list maintained with LIST_* macros.

diffstat:

 sys/kern/vfs_cache.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ad1339090e1e -r beb51ea06742 sys/kern/vfs_cache.c
--- a/sys/kern/vfs_cache.c      Fri Jan 16 18:45:01 2015 +0000
+++ b/sys/kern/vfs_cache.c      Fri Jan 16 20:10:25 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_cache.c,v 1.104 2015/01/04 19:31:00 pooka Exp $    */
+/*     $NetBSD: vfs_cache.c,v 1.105 2015/01/16 20:10:25 dennis Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.104 2015/01/04 19:31:00 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.105 2015/01/16 20:10:25 dennis Exp $");
 
 #include "opt_ddb.h"
 #include "opt_revcache.h"
@@ -397,7 +397,7 @@
        ncpp = &nchashtbl[NCHASH2(hash, dvp)];
 
        LIST_FOREACH(ncp, ncpp, nc_hash) {
-               /* XXX Needs barrier for Alpha here */
+               membar_datadep_consumer();      /* for Alpha... */
                if (ncp->nc_dvp != dvp ||
                    ncp->nc_nlen != namelen ||
                    memcmp(ncp->nc_name, name, (u_int)ncp->nc_nlen))



Home | Main Index | Thread Index | Old Index