tech-kern archive

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

Re: make mbuf clusters coherency aligned again



Le 17/10/2019 à 19:39, Tobias Nygren a écrit :
Hi,

Since there were some concerns raised that this problem shouldn't be
fixed in the driver ...

https://mail-index.netbsd.org/source-changes/2019/10/15/msg109984.html

... I'm going partially back it out and commit this change instead.

To summarize why; having mbuf clusters not coherency aligned is
generally unsafe because there is as far as I have been able to
determine nothing that prevents the kernel from clobbering memory in
lower portion of the cache line whilst the upper portion of the cache
line is involved in a DMA transfer.

Index: uipc_mbuf.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.234
diff -p -u -r1.234 uipc_mbuf.c
--- uipc_mbuf.c	28 Sep 2019 16:02:12 -0000	1.234
+++ uipc_mbuf.c	17 Oct 2019 17:32:30 -0000
@@ -188,8 +188,8 @@ mbinit(void)
  	    NULL, IPL_VM, mb_ctor, NULL, NULL);
  	KASSERT(mb_cache != NULL);
- mcl_cache = pool_cache_init(mclbytes, 0, 0, 0, "mclpl", NULL,
-	    IPL_VM, NULL, NULL, NULL);
+	mcl_cache = pool_cache_init(mclbytes, COHERENCY_UNIT, 0, 0, "mclpl",
+	    NULL, IPL_VM, NULL, NULL, NULL);
  	KASSERT(mcl_cache != NULL);
pool_cache_set_drain_hook(mb_cache, mb_drain, NULL);

Yes, looks good to me.


Home | Main Index | Thread Index | Old Index