unstick r337223

Revision 337223

Date:
2018/05/12 20:00:29
Author:
mmacy
Revision Log:
hwpmc/epoch - don't reference domain if NUMA is not set

It appears that domain information is set correctly independent
of whether or not NUMA is defined. However, there is no memory
backing secondary domains leading to allocation failure.

Reported by: pho@, np@
Approved by: sbruno@
Files:

Legend:

 
Added
 
Removed
 
Modified
  • mirror/FreeBSD/head/sys/dev/hwpmc/hwpmc_logging.c

     
    61 61 #include <sys/unistd.h>
    62 62 #include <sys/vnode.h>
    63 63
    64 #ifdef NUMA
    65 #define NDOMAINS vm_ndomains
    66
    67 static int
    68 getdomain(int cpu)
    69 {
    70 struct pcpu *pc;
    71
    72 pc = pcpu_find(cpu);
    73 return (pc->pc_domain);
    74 }
    75 #else
    76 #define NDOMAINS 1
    77 #define malloc_domain(size, type, domain, flags) malloc((size), (type), (flags))
    78 #define free_domain(addr, type) free(addr, type)
    79 #define getdomain(cpu) 0
    80 #endif
    81
    64 82 /*
    65 83 * Sysctl tunables
    66 84 */
     
    1148 1166 pmclog_initialize()
    1149 1167 {
    1150 1168 int domain, cpu;
    1151 struct pcpu *pc;
    1152 1169 struct pmclog_buffer *plb;
    1153 1170
    1154 1171 if (pmclog_buffer_size <= 0 || pmclog_buffer_size > 16*1024) {
     
    1170 1187 pmc_nlogbuffers_pcpu = PMC_NLOGBUFFERS_PCPU;
    1171 1188 pmclog_buffer_size = PMC_LOG_BUFFER_SIZE;
    1172 1189 }
    1173 for (domain = 0; domain < vm_ndomains; domain++) {
    1190 for (domain = 0; domain < NDOMAINS; domain++) {
    1174 1191 pmc_dom_hdrs[domain] = malloc_domain(sizeof(struct pmc_domain_buffer_header), M_PMC, domain,
    1175 1192 M_WAITOK|M_ZERO);
    1176 1193 mtx_init(&pmc_dom_hdrs[domain]->pdbh_mtx, "pmc_bufferlist_mtx", "pmc-leaf", MTX_SPIN);
    1177 1194 TAILQ_INIT(&pmc_dom_hdrs[domain]->pdbh_head);
    1178 1195 }
    1179 1196 CPU_FOREACH(cpu) {
    1180 if (CPU_ABSENT(cpu))
    1181 continue;
    1182 pc = pcpu_find(cpu);
    1183 domain = pc->pc_domain;
    1197 domain = getdomain(cpu);
    1198 KASSERT(pmc_dom_hdrs[domain] != NULL, ("no mem allocated for domain: %d", domain));
    1184 1199 pmc_dom_hdrs[domain]->pdbh_ncpus++;
    1185 1200 }
    1186 for (domain = 0; domain < vm_ndomains; domain++) {
    1201 for (domain = 0; domain < NDOMAINS; domain++) {
    1187 1202 int ncpus = pmc_dom_hdrs[domain]->pdbh_ncpus;
    1188 1203 int total = ncpus*pmc_nlogbuffers_pcpu;
    1189 1204
     
    1215 1230
    1216 1231 mtx_destroy(&pmc_kthread_mtx);
    1217 1232
    1218 for (domain = 0; domain < vm_ndomains; domain++) {
    1233 for (domain = 0; domain < NDOMAINS; domain++) {
    1219 1234 mtx_destroy(&pmc_dom_hdrs[domain]->pdbh_mtx);
    1220 1235 while ((plb = TAILQ_FIRST(&pmc_dom_hdrs[domain]->pdbh_head)) != NULL) {
    1221 1236 TAILQ_REMOVE(&pmc_dom_hdrs[domain]->pdbh_head, plb, plb_next);
  • mirror/FreeBSD/head/sys/dev/hwpmc/hwpmc_mod.c

     
    76 76
    77 77 #include "hwpmc_soft.h"
    78 78
    79 #ifdef NUMA
    80 #define NDOMAINS vm_ndomains
    81 #else
    82 #define NDOMAINS 1
    83 #define malloc_domain(size, type, domain, flags) malloc((size), (type), (flags))
    84 #define free_domain(addr, type) free(addr, type)
    85 #endif
    86
    79 87 /*
    80 88 * Types
    81 89 */
  • mirror/FreeBSD/head/sys/kern/subr_epoch.c

     
    119 119
    120 120 static void epoch_call_task(void *context);
    121 121
    122 #if defined(__powerpc64__) || defined(__powerpc__)
    122 #if defined(__powerpc64__) || defined(__powerpc__) || !defined(NUMA)
    123 123 static bool usedomains = false;
    124 124 #else
    125 125 static bool usedomains = true;