Page MenuHomeFreeBSD

D42262.id129061.diff
No OneTemporary

D42262.id129061.diff

diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -254,7 +254,7 @@
panic("No support for this CPU type (%08x) in kernel", cputype);
return(ARCHITECTURE_NOT_PRESENT);
out:
- uma_set_align(arm_dcache_align_mask);
+ uma_set_cache_align_mask(arm_dcache_align_mask);
return (0);
}
diff --git a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
--- a/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+++ b/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
@@ -44,6 +44,7 @@
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <vm/pmap.h>
+#include <vm/_uma_align_mask.h>
#include <machine/bus.h>
@@ -350,8 +351,7 @@
#define dma_unmap_len(p, name) ((p)->name)
#define dma_unmap_len_set(p, name, v) (((p)->name) = (v))
-extern int uma_align_cache;
-#define dma_get_cache_alignment() uma_align_cache
+#define dma_get_cache_alignment() uma_get_cache_align_mask()
static inline int
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_taskq.c
@@ -66,8 +66,6 @@
proc_t *system_proc;
-extern int uma_align_cache;
-
static MALLOC_DEFINE(M_TASKQ, "taskq", "taskq structures");
static CK_LIST_HEAD(tqenthashhead, taskq_ent) *tqenthashtbl;
diff --git a/sys/vm/_uma_align_mask.h b/sys/vm/_uma_align_mask.h
new file mode 100644
--- /dev/null
+++ b/sys/vm/_uma_align_mask.h
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Olivier Certner <olce.freebsd@certner.fr>
+ * at Kumacom SAS under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __VM__UMA_ALIGN_MASK_H
+#define __VM__UMA_ALIGN_MASK_H
+
+/*
+ * Returns the alignment mask to be used for all zones requesting cache
+ * alignment.
+ *
+ * Arguments:
+ * Nothing
+ *
+ * Returns:
+ * The alignment mask
+ */
+int uma_get_cache_align_mask(void) __pure;
+
+#endif /* !__VM__UMA_ALIGN_MASK_H */
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -470,12 +470,19 @@
* alignment. Should be called by MD boot code prior to starting VM/UMA.
*
* Arguments:
- * align The alignment mask
+ * mask The alignment mask
*
* Returns:
* Nothing
*/
-void uma_set_align(int align);
+void uma_set_cache_align_mask(int mask);
+
+/*
+ * This separate header contains the declaration of uma_get_cache_align_mask()
+ * to avoid namespace pollution in header/source files that need no more than
+ * this function.
+ */
+#include <vm/_uma_align_mask.h>
/*
* Set a reserved number of items to hold for M_USE_RESERVE allocations. All
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -150,7 +150,7 @@
static uma_zone_t hashzone;
/* The boot-time adjusted value for cache line alignment. */
-int uma_align_cache = 64 - 1;
+static int uma_cache_align_mask = 64 - 1;
static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets");
static MALLOC_DEFINE(M_UMA, "UMA", "UMA Misc");
@@ -3243,7 +3243,7 @@
args.size = size;
args.uminit = uminit;
args.fini = fini;
- args.align = (align == UMA_ALIGN_CACHE) ? uma_align_cache : align;
+ args.align = (align == UMA_ALIGN_CACHE) ? uma_cache_align_mask : align;
args.flags = flags;
args.zone = zone;
return (zone_alloc_item(kegs, &args, UMA_ANYDOMAIN, M_WAITOK));
@@ -3252,11 +3252,18 @@
/* Public functions */
/* See uma.h */
void
-uma_set_align(int align)
+uma_set_cache_align_mask(int mask)
{
- if (align != UMA_ALIGN_CACHE)
- uma_align_cache = align;
+ if (mask >= 0)
+ /* UMA_ALIGN_CACHE is also not permitted here. */
+ uma_cache_align_mask = mask;
+}
+
+int
+uma_get_cache_align_mask(void)
+{
+ return (uma_cache_align_mask);
}
/* See uma.h */

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 20, 8:58 AM (18 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36986590
Default Alt Text
D42262.id129061.diff (5 KB)

Event Timeline