From d55b9d74e2609fa7a02b33e452f38c364c4d4720 Mon Sep 17 00:00:00 2001 From: pjd Date: Wed, 1 Nov 2006 16:05:06 +0000 Subject: 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 MFC after: 1 week --- sys/geom/eli/g_eli.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sys/geom') 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; -- cgit v1.1