diff options
author | pjd <pjd@FreeBSD.org> | 2006-11-01 16:05:06 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-11-01 16:05:06 +0000 |
commit | d55b9d74e2609fa7a02b33e452f38c364c4d4720 (patch) | |
tree | d47a0bebd9e8f2292ef4ab5bcb4ebd53c087080a /sys | |
parent | 253a40310d4c23850e4d46e5d31d5fd536287c73 (diff) | |
download | FreeBSD-src-d55b9d74e2609fa7a02b33e452f38c364c4d4720.zip FreeBSD-src-d55b9d74e2609fa7a02b33e452f38c364c4d4720.tar.gz |
Skip disabled CPU, because after we sched_bind() to a disabled CPU,
we won't be able to exit from the thread.
Function g_eli_cpu_is_disabled() stoled from kern_pmc.c.
PR: 104669
Reported by: Nikolay Mirin <nik@optim.com.ru>
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/geom/eli/g_eli.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index a1965b8..7649b1d 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -481,6 +481,16 @@ g_eli_access(struct g_provider *pp, int dr, int dw, int de) return (0); } +static int +g_eli_cpu_is_disabled(int cpu) +{ +#ifdef SMP + return ((hlt_cpus_mask & (1 << cpu)) != 0); +#else + return (0); +#endif +} + struct g_geom * g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, const struct g_eli_metadata *md, const u_char *mkey, int nkey) @@ -630,6 +640,11 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, G_ELI_DEBUG(0, "Reducing number of threads to %u.", threads); } for (i = 0; i < threads; i++) { + if (g_eli_cpu_is_disabled(i)) { + G_ELI_DEBUG(1, "%s: CPU %u disabled, skipping.", + bpp->name, threads); + continue; + } wr = malloc(sizeof(*wr), M_ELI, M_WAITOK | M_ZERO); wr->w_softc = sc; wr->w_number = i; @@ -638,7 +653,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, * If this is the first pass, try to get hardware support. * Use software cryptography, if we cannot get it. */ - if (i == 0) { + if (LIST_EMPTY(&sc->sc_workers)) { error = crypto_newsession(&wr->w_sid, &crie, 1); if (error == 0) sc->sc_crypto = G_ELI_CRYPTO_HW; |