From owner-freebsd-current@freebsd.org Sun Aug 25 16:15:21 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA984E2B48 for ; Sun, 25 Aug 2019 16:15:21 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46GgGK2DyGz45Xt for ; Sun, 25 Aug 2019 16:15:20 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io1-xd44.google.com with SMTP id t6so31561758ios.7 for ; Sun, 25 Aug 2019 09:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=yslmllb3LykXSNkiFCbrqbI3snRvli133GndsBOTx3U=; b=aPHgLmTosE967SZRogqV9GwqbM8+SQt9Cn9v+eLOWwLTrfKOTWhqc7qXRp1860tjd3 ch4uTwFRiai3oPYkG2/HmMSwFWkNQKkS4slwAlxi4vtkBXhiIPt1Zm+0L3JM+sEhW6qN 2ANlY5jia5yYK8eP8jf6JVi2cybxyBaGoOufaq51zF1yMxRtkgFWMDR/gojy+zYrBVlT UWqubqVNOaKDYkimPCbN3g0BGtTc/Xeb3QDFIQ3nTm9R3GFdm4+5PwcEHelz7PfTf2qR xaCikNv5eqcjcJgWwDkawOmiUPHOoApuk1STENKps4GpwYi2KJVJtwGvvfz9MYAnm8Eg Q8iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=yslmllb3LykXSNkiFCbrqbI3snRvli133GndsBOTx3U=; b=czr4kYoMNp+XyG91PMhwfWt3CZJ8b51MyeZPf4NN0LEc/lyslZlW/mgfjig2zliSDT 29cyykpMcaFweCCHZzKIy8O78CJvE7MUn7/Qn2jdesp/kJNHCGJpZrOZ0G1usNSeNUbH Bl/nQjV/qNSWwindL2Qv+Z6jWxV4Zkkli1SI/SSLKkAOyJ5IEMzh1FNwoBn7+APBidQS CrYvG3Ji1JeSV5QyB0uZs5xq/9i7h/UOy8okfhLVClJPHwJA8vjvOfAXwCDoBKzCbYYO RQESN/9qve/bwtnVtngVFt9ulxNUtcD4EohIWUSy0kbUVdPCKcGdvKCagtFTI8Zt91rh 2xag== X-Gm-Message-State: APjAAAXQm5BACIXA57pZBKSJLh4Z5XekLyOu8t6BkMqVjvxZFnMCihxN 7WfhkkuB1Z/tuPIFVlwkShU= X-Google-Smtp-Source: APXvYqyLWPPZ44rwkFpaOKq7VEwT1M1pCvU1yWoaaQdmJxcqJdJMx8Y3fNLY0f3YLGcAkOIB+ZMREA== X-Received: by 2002:a05:6602:2593:: with SMTP id p19mr12631926ioo.138.1566749719365; Sun, 25 Aug 2019 09:15:19 -0700 (PDT) Received: from raichu (toroon0560w-lp140-03-184-148-66-213.dsl.bell.ca. [184.148.66.213]) by smtp.gmail.com with ESMTPSA id f1sm8260488ioh.73.2019.08.25.09.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2019 09:15:18 -0700 (PDT) Sender: Mark Johnston Date: Sun, 25 Aug 2019 12:15:13 -0400 From: Mark Johnston To: Konstantin Belousov Cc: Rebecca Cran , FreeBSD Current Subject: Re: Panic on boot with r351461 (AMD ThreadRipper 2990WX) Message-ID: <20190825161513.GA33382@raichu> References: <6e5687b2-ab3f-a570-37ab-72c8a9776167@bsdio.com> <20190824203305.GF71821@kib.kiev.ua> <20190824230801.GK71821@kib.kiev.ua> <20190825062407.GL71821@kib.kiev.ua> <9e94aea8-7d63-0f9e-2f1e-c1492e9dc455@bsdio.com> <20190825143034.GO71821@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190825143034.GO71821@kib.kiev.ua> User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46GgGK2DyGz45Xt X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=aPHgLmTo; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::d44 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-3.25 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.98)[-0.978,0]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[213.66.148.184.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-0.57)[ip: (2.40), ipnet: 2607:f8b0::/32(-2.87), asn: 15169(-2.34), country: US(-0.05)]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[4.4.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Aug 2019 16:15:22 -0000 On Sun, Aug 25, 2019 at 05:30:34PM +0300, Konstantin Belousov wrote: > On Sun, Aug 25, 2019 at 07:17:20AM -0600, Rebecca Cran wrote: > > On 2019-08-25 00:24, Konstantin Belousov wrote: > > > What are the panic messages ? > > > > Fatal trap 18: integer divide fault while in kernel mode > > > > instruction pointer = 0x20:0xffffffff80f1027c > > > > stack pointer = 0x28:0xffffffff845809f0 > > > > frame pointer = 0x28:0xffffffff84580a00 > > > > code segment = base 0x0, limit 0xffffff, type 0x1b > > > >     = DPL 0, pres 1, long 1, def32 0, gran 1 > > > > processor eflags = resume, IOPL = 0 > > > > current process = 0 () > > > > trap number = 18 > > > > panic: integer divide fault > > > > cpuid = 0 > > > > time = 1 > > > > > > > What is the source line ? > > > > (gdb) info line *0xffffffff80f1027c > > Line 102 of "/usr/src/sys/vm/vm_domainset.c" starts at address > > 0xffffffff80f10267 > >    and ends at 0xffffffff80f1027f . > > There was one more source line I asked about. > > So what happens, IMO, is that for memory-less domains ds_cnt is zero > because ds_mask is zero, which causes the exception on divide. You > can try the following combined patch, but I really dislike the fact > that I cannot safely use DOMAINSET_FIXED (if my diagnosis is correct). I think this is simply a bug. Something like the following hack should work: we want to leave the _FIXED domainsets unmodified, but they should be removed from the global list (to ensure that userspace cannot specify impossible policies). diff --git a/sys/kern/kern_cpuset.c b/sys/kern/kern_cpuset.c index 87f9333bf43b..931fe7e157e5 100644 --- a/sys/kern/kern_cpuset.c +++ b/sys/kern/kern_cpuset.c @@ -503,9 +503,17 @@ domainset_empty_vm(struct domainset *domain) int i, j, max; max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = 0; i < max; i++) - if (DOMAINSET_ISSET(i, &domain->ds_mask) && VM_DOMAIN_EMPTY(i)) + for (i = 0; i < max; i++) { + if (DOMAINSET_ISSET(i, &domain->ds_mask) && + VM_DOMAIN_EMPTY(i)) { + /* + * Leave the domainset unmodified, in case it is a + * static policy defined for use by the kernel. + */ + if (domain->ds_cnt == 1) + return (true); DOMAINSET_CLR(i, &domain->ds_mask); + } domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); max = DOMAINSET_FLS(&domain->ds_mask) + 1; for (i = j = 0; i < max; i++) { > I would prefer for kmem_malloc_domainset(DOMAINSET_FIXED(unpopulated domain)) > to fail with NULL result, and then I would manually fall-back to > DOMAINSET_PREF(). > > OTOH, I think the chunk for mp_realloc_cpu() is the final fix. Looks ok to me.