From nobody Wed Jul 07 09:40:21 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D501E11F6043 for ; Wed, 7 Jul 2021 09:40:25 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4GKZCs5S4Qz3vc7; Wed, 7 Jul 2021 09:40:25 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-ed1-x52d.google.com with SMTP id l24so2521763edr.11; Wed, 07 Jul 2021 02:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Zt0wldDoDPfwcAvhm3o/tt4FU1OvUv2uVgtIOfmP5iw=; b=cpZvcI1vNyGmyUQULW55LogLBbyrDo500a+QRopJsT20bySJ4qgbqWQxSiMHQmO/ai 2SRi17sSGMMxlIdj70+sktAFm3qEs4oNCFylWk+PlFPVaYVQaUr/Iz0QQCsDpLHRfvXY bI823Pf0wlh2H9Zlfl3e8fZ2OmeSUy1FeBY0RJoHJSV1xPyVliIbaJrc5CG0dQplEf4D 2lPuuJMpfVoCQiFhWqcDbeB3gOdKIDfXbvK6A1oR6Be94tz9qAJhTEgaRZnuvrDxRmlo WOLJeHCbpbNqZSlEgZYNkg3DkvjDFtF6nHfsMLKl3hdC7IdUXYmsVDG/yx8Wy6S+VFsQ M8lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Zt0wldDoDPfwcAvhm3o/tt4FU1OvUv2uVgtIOfmP5iw=; b=UzkCUmUkQoUoHdZlMsYeMetp2nTz9fDv8xdPIGys0EJl5+35EuPFPg6kRUsK0V6OOp k/TnOvdNAyl+rZRtITWgK8Z4wXw36KOTK3VF4aGff1qZJpm7XoQYaK9KKDY/ETCnb+gc nbmnxWoOsnn7We7iZLyZWqI4hN7ZI2ABHHVNXZK8LjxiZjsrWYupzI8wFrnKS1uatMa0 GGMqdHJGFNWky6w5p3rnPePqhGxpGGMa/ZrGItHvv4ilEtFF0CM7knAnkshk5M/ewNRQ LSHmNaFYsLx+pOQGpa5mpR4BzCOnDH9eBZq1ZvuiddlvieAzynT/eVlyHNC90ThssYqK /AEg== X-Gm-Message-State: AOAM530/FxSyamISxyto+3Syh/Y8Bq1OFiwA5f0TRbh3aFtoRvOwLils tgMPPYLcYLGZWcD01HBi4zk/zfTTUAk= X-Google-Smtp-Source: ABdhPJz6VNZE6Qx9yeeUkKHAJRldgoIEs5KkVbkjAmmqbRLVhOBybYyzIV6Zz6s77GhMhXBd6MS3Yw== X-Received: by 2002:aa7:c450:: with SMTP id n16mr28402270edr.58.1625650824123; Wed, 07 Jul 2021 02:40:24 -0700 (PDT) Received: from ernst.home (pd9e2360f.dip0.t-ipconnect.de. [217.226.54.15]) by smtp.gmail.com with ESMTPSA id br4sm6653403ejb.110.2021.07.07.02.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 02:40:23 -0700 (PDT) Date: Wed, 7 Jul 2021 11:40:21 +0200 From: Gary Jennejohn To: Edward Tomasz Napiera?a Cc: FreeBSD Current Subject: Re: panic: Unaligned free (was: kernel panic while copying files) Message-ID: <20210707094021.631a005b@ernst.home> In-Reply-To: References: <20210608155405.5cf0e200@ernst.home> <20210610095041.38d7597c@ernst.home> <20210629094201.77ef5f22@ernst.home> <20210630125703.2b5544e7@ernst.home> <20210701035800.410d2376@ernst.home> <20210701113026.59f864e9@ernst.home> <20210705163324.29466849@ernst.home> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GKZCs5S4Qz3vc7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Wed, 7 Jul 2021 09:38:05 +0100 Edward Tomasz Napiera?a wrote: > On 0705T1833, Gary Jennejohn wrote: > > On Mon, 5 Jul 2021 15:04:48 +0100 > > Edward Tomasz Napiera__a wrote: > > > > > On 0701T1330, Gary Jennejohn wrote: > > > > Gary Jennejohn wrote: > > > > > I noticed that the value of vm.debug.divisor affects what value is > > > > > returned in uma_core.c:uma_dbg_kskip(), so I decided to try a few > > > > > different values. > > > > > > > > > > The returned value is used to set skipdbg in uma_core.c:item_dtor(). > > > > > > > > > > The default is vm.debug.divisor=1. > > > > > > > > > > vm.debug.divisor is only present when INVARIANTS is defined. > > > > > > > > > > kskipdbg eventually affects the value of freei. > > > > > > > > > > With these values: > > > > > vm.debug.divisor: 0 > > > > > kern.cam.da.enable_uma_ccbs: 1 > > > > > I can turn on the disk and it comes up without a panic! > > > > > > > > > > However, I didn't try to do any large data transfers to the disk. > > > > > > > > > > So, it appears that at least vm.debug.divisor is a big factor in > > > > > whether or not a panic happens with INVARIANTS. > > > > > > > > > > > > > I decided to do a real test. So I built a kernel w/o INVARIANTS and > > > > installed it to /boot/test. > > > > > > > > Then I stuck a 160GB disk I had around into an external USB3 enclosure > > > > and put a filesystem on it. > > > > > > > > The I booted the new kernel from /boot/test and set the sysctls so: > > > > kern.cam.da.enable_uma_ccbs: 1 > > > > kern.cam.ada.enable_uma_ccbs: 1 > > > > > > > > After that I plugged in the external USB3 enclosure and copied about > > > > 114GiB of data from an internal SSD to it - without a kernel panic: > > > > Filesystem Size Used Avail Capacity Mounted on > > > > /dev/da0p1 144G 114G 18G 86% /mnt > > > > > > > > I'm pretty sure that's more than I could copy without a kernel panic > > > > prior to the recent changes made in cam and umass. > > > > > > > > My test may not be real proof that all bugs have been squashed, but it > > > > certainly seems to be a better situation than we had before. > > > > > > I think the vm.debug.divisor simply masks the problem; the underlying > > > bug is still there. > > > > > > Could you go back to the setup which panics, and then test the patch > > > at https://reviews.freebsd.org/D31054? It fixes the scenario described > > > by Warner. > > > > > > > It looks like this patch fixes things. > > > > I used the default value vm.debug.divisor=1 and both enable_uma_ccbs=1 > > (which are now the default values on my system). > > > > I used the 8TiB disk, which spins up very slowly and usually resulted very > > quickly in a panic - no panic with the patch. > > > > Then using dd to /dev/null (bs=1m) I transferred: > > > > 308755+0 records in > > 308755+0 records out > > 323753082880 bytes transferred in 1366.162410 secs (236979938 bytes/sec) > > > > from the disk, so about 324GiB without a panic. > > Perfect, I've committed the fix. Thank you! > Thanks to you! I built a new kernel as soon as I saw the commit and am running it since yesterday. -- Gary Jennejohn