Skip to content

Commit

Permalink
13218 "Stack smashing detected" panic when creating vnic over aggr wi…
Browse files Browse the repository at this point in the history
…th 4 mlxcx links

13222 Increase maximum number of fanout CPUs from 128 to 256
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
pwinder committed Dec 16, 2020
1 parent cc37296 commit 3714f7b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
51 changes: 25 additions & 26 deletions usr/src/uts/common/io/mac/mac_datapath_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2018 Joyent, Inc.
* Copyright 2020 RackTop Systems.
*/

#include <sys/types.h>
Expand Down Expand Up @@ -1072,17 +1073,22 @@ mac_flow_cpu_init(flow_entry_t *flent, cpupart_t *cpupart)
{
mac_soft_ring_set_t *rx_srs;
processorid_t cpuid;
int i, j, k, srs_cnt, nscpus, maxcpus, soft_ring_cnt = 0;
int i, j, k, srs_cnt, maxcpus, soft_ring_cnt = 0;
mac_cpus_t *srs_cpu;
mac_resource_props_t *emrp = &flent->fe_effective_props;
uint32_t cpus[MRP_NCPUS];

/*
* The maximum number of CPUs available can either be
* the number of CPUs in the pool or the number of CPUs
* in the system.
*/
maxcpus = (cpupart != NULL) ? cpupart->cp_ncpus : ncpus;
/*
* We cannot exceed the hard limit imposed by data structures.
* Leave space for polling CPU and the SRS worker thread when
* "mac_latency_optimize" is not set.
*/
maxcpus = MIN(maxcpus, MRP_NCPUS - 2);

/*
* Compute the number of soft rings needed on top for each Rx
Expand All @@ -1102,7 +1108,10 @@ mac_flow_cpu_init(flow_entry_t *flent, cpupart_t *cpupart)
*/
soft_ring_cnt = 1;
}
for (srs_cnt = 0; srs_cnt < flent->fe_rx_srs_cnt; srs_cnt++) {

emrp->mrp_ncpus = 0;
for (srs_cnt = 0; srs_cnt < flent->fe_rx_srs_cnt &&
emrp->mrp_ncpus < MRP_NCPUS; srs_cnt++) {
rx_srs = flent->fe_rx_srs[srs_cnt];
srs_cpu = &rx_srs->srs_cpu;
if (rx_srs->srs_fanout_state == SRS_FANOUT_INIT)
Expand All @@ -1129,32 +1138,22 @@ mac_flow_cpu_init(flow_entry_t *flent, cpupart_t *cpupart)
}
srs_cpu->mc_rx_workerid = cpuid;
mutex_exit(&cpu_lock);
}

nscpus = 0;
for (srs_cnt = 0; srs_cnt < flent->fe_rx_srs_cnt; srs_cnt++) {
rx_srs = flent->fe_rx_srs[srs_cnt];
srs_cpu = &rx_srs->srs_cpu;
for (j = 0; j < srs_cpu->mc_ncpus; j++) {
cpus[nscpus++] = srs_cpu->mc_cpus[j];
}
}


/*
* Copy cpu list to fe_effective_props
* without duplicates.
*/
k = 0;
for (i = 0; i < nscpus; i++) {
for (j = 0; j < k; j++) {
if (emrp->mrp_cpu[j] == cpus[i])
break;
/*
* Copy fanout CPUs to fe_effective_props without duplicates.
*/
for (i = 0; i < srs_cpu->mc_ncpus &&
emrp->mrp_ncpus < MRP_NCPUS; i++) {
for (j = 0; j < emrp->mrp_ncpus; j++) {
if (emrp->mrp_cpu[j] == srs_cpu->mc_cpus[i])
break;
}
if (j == emrp->mrp_ncpus) {
emrp->mrp_cpu[emrp->mrp_ncpus++] =
srs_cpu->mc_cpus[i];
}
}
if (j == k)
emrp->mrp_cpu[k++] = cpus[i];
}
emrp->mrp_ncpus = k;

mac_tx_cpu_init(flent, NULL, cpupart);
}
Expand Down
13 changes: 7 additions & 6 deletions usr/src/uts/common/sys/mac_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2013 Joyent, Inc. All rights reserved.
* Copyright 2020 RackTop Systems, Inc.
*/

#ifndef _MAC_FLOW_H
Expand Down Expand Up @@ -92,7 +93,7 @@ typedef struct flow_desc_s {
uint8_t fd_dsfield_mask;
} flow_desc_t;

#define MRP_NCPUS 128
#define MRP_NCPUS 256

/*
* In MCM_CPUS mode, cpu bindings is user specified. In MCM_FANOUT mode,
Expand All @@ -118,7 +119,7 @@ typedef struct mac_tx_intr_cpus_s {

typedef struct mac_cpus_props_s {
uint32_t mc_ncpus; /* num of cpus */
uint32_t mc_cpus[MRP_NCPUS]; /* cpu list */
uint32_t mc_cpus[MRP_NCPUS]; /* cpu list */
uint32_t mc_rx_fanout_cnt; /* soft ring cpu cnt */
uint32_t mc_rx_fanout_cpus[MRP_NCPUS]; /* SR cpu list */
uint32_t mc_rx_pollid; /* poll thr binding */
Expand Down Expand Up @@ -188,10 +189,10 @@ typedef struct mac_protect_s {
/* The default priority for flows */
#define MPL_SUBFLOW_DEFAULT MPL_MEDIUM

#define MRP_MAXBW 0x00000001 /* Limit set */
#define MRP_CPUS 0x00000002 /* CPU/fanout set */
#define MRP_CPUS_USERSPEC 0x00000004 /* CPU/fanout from user */
#define MRP_PRIORITY 0x00000008 /* Priority set */
#define MRP_MAXBW 0x00000001 /* Limit set */
#define MRP_CPUS 0x00000002 /* CPU/fanout set */
#define MRP_CPUS_USERSPEC 0x00000004 /* CPU/fanout from user */
#define MRP_PRIORITY 0x00000008 /* Priority set */
#define MRP_PROTECT 0x00000010 /* Protection set */
#define MRP_RX_RINGS 0x00000020 /* Rx rings */
#define MRP_TX_RINGS 0x00000040 /* Tx rings */
Expand Down

0 comments on commit 3714f7b

Please sign in to comment.