From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CDAE213253 for ; Fri, 10 Jan 2025 17:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736530089; cv=none; b=nggYaxDcmocu65pOn3XcCJ7k1jU68x9CL6ckSVocxGfvN1V15Cecxa/lhKYRgNlrFXkWhN3hals/uXHtc/2xWBL6lkexVyfMp1177t3Dj0SjTY7N29MI6WUBgcgEwi03z+7BbrvhLwBsZiR9t2X98yOyAlPMeCBdk+JOoKVxx2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736530089; c=relaxed/simple; bh=lZDBidSIkKD4CqnnnMbmz3fZkFILTRbJA10eU+tq7eU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=fEOzVNP7iMswh4iMrxi1qDI47UO2PjcQ5VzEmw4a9cv2ytyudifjfZSlcvnp1s84ryMzCVY5tFRg2usYz4h+981mW32ztWVzkK2oIkWBb3ugO6kqcsHqA5kEkqjaDpub6ZCbdSg3jy/tgjAQv0ONqGvKBvXNuRg8CAq9rBalkPk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Oihtt20M; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Oihtt20M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736530086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=77X/UwpeY1uxr0hfwTcsIMpjjeRE4KGJs9Qu6AVGY1I=; b=Oihtt20MzJQDDLqtu97Bpn6QMY8Dwf6zPg/nM1Yp0npXXp4gvKPVXq788Ip8z74LTlJN0T hhT1TnKrXyXkVXSXQPVkpLyi3OiG6ujMblkdka767p9CnfmYs2ui62GXnnm7YWVKvL/Mmb LKf+GvJdDrJ2fI5EaiOVrMaR2/HLpFI= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-l52wcnApOWyZg1Y9wMGI5A-1; Fri, 10 Jan 2025 12:28:05 -0500 X-MC-Unique: l52wcnApOWyZg1Y9wMGI5A-1 X-Mimecast-MFC-AGG-ID: l52wcnApOWyZg1Y9wMGI5A Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-216387ddda8so45195725ad.3 for ; Fri, 10 Jan 2025 09:28:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736530084; x=1737134884; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=77X/UwpeY1uxr0hfwTcsIMpjjeRE4KGJs9Qu6AVGY1I=; b=bx1N7bstRTcbIHXZXm6udINw4HLTL4iB9qs3ZO88pvCIVjYbF6rKq2DvUQUTjlBrxK wEqOn5bdbX9XiahNVUKqFbu+K6NhTOTLnSYMkbHGMc1U5EyzbfE9hJiZh28If4t0v7Ci bFbo8j4WPl+t/4m/5BPqSP6Gb50hQeISBFssTIM5xE+XNJaFT5aq5JfH73PQkeDimZfU bWzDhp78uPcyRQNaXKvMp97j1TRrOU5vgh5i/6ApmOkT+fBGOTByYAOGDKmkt6PjOm6d XiV7hWSdzejZl4i4rbnc47VbfYsNTKu/fYNvLCXk1+XW5CF2bQxlGCSH/WsjVtUQdy6O dCxg== X-Gm-Message-State: AOJu0YxLkhq7ns+GqBVx52QBrl7LMo3N3jXJYFxMljPbAvwdksyV1rtL wV5kqdFtHbMyjHQplreS1qAT18kgfQ+IePydxPTM1NoW1FmPo/keqX7v3Jace4j0RWA0u23+Rg+ /oici1jMOQUUZ8Dei5AiFSTy4kn+KQnY1j8rvuwnCTmTMPxF3s7Hi5eixfVUf X-Gm-Gg: ASbGncsjSAFoxQ7hxiM+2BL6CHq5CG1feqRqbeyun5pnuWna7Px3M5cgsVTO0W+ScvH wVEFdxQ75rYxlehc3UKvTCvYdPhxudtyBuVKeBLzqcDslG0BhEHjBSMDk5b3gnATE9zZq9WVWnN 169zSsc2dohLzNJ8kl53jofgbozABmD6uvIY1+wzBsjbWJcSog6vYcqBsvNKRNlKYVn6vKP3d7/ 1An2HLuQTm5ayFRrFRedOaMc6PaUSqZC0YzK1kdiQm6D3EhbK4yaHviKITOfqC/xnkfSFjhPBR1 Eg== X-Received: by 2002:a05:6a20:12c6:b0:1db:ef68:e505 with SMTP id adf61e73a8af0-1e88d10e95amr20208702637.20.1736530084078; Fri, 10 Jan 2025 09:28:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAaqV8LSGKlws6oJGpREsqihBfyntoBxNN0MJXKyIdf8pfqT4RZz9CrZMQRrwX7Jhmmyw7uw== X-Received: by 2002:a05:6a20:12c6:b0:1db:ef68:e505 with SMTP id adf61e73a8af0-1e88d10e95amr20208666637.20.1736530083589; Fri, 10 Jan 2025 09:28:03 -0800 (PST) Received: from omnibook.happyassassin.net ([2001:569:5316:e500:6db9:d886:b530:8752]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d40681c05sm1831703b3a.141.2025.01.10.09.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 09:28:02 -0800 (PST) Message-ID: <565d943ae51707002807d198b913bcd2f25a3ef5.camel@redhat.com> Subject: Re: Kernel crash while doing chroot'ed grub2-mkconfig on qemu-emulated Nehalem CPU since late November 6.13 snapshot From: Adam Williamson To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, jforbes@redhat.com, mcgrof@kernel.org Date: Fri, 10 Jan 2025 09:28:01 -0800 In-Reply-To: References: <9a3c747052fb82274ab3c4a84eaf64c1273117ce.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.2 (3.54.2-1.fc41app1) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2025-01-10 at 11:57 +0200, Mike Rapoport wrote: > Hi Adam, >=20 > On Thu, Jan 02, 2025 at 12:16:03PM -0800, Adam Williamson wrote: > > On Wed, 2024-12-11 at 08:51 -0800, Adam Williamson wrote: > > > Hi, folks. Please CC me on replies, I'm not subscribed to the list. T= he > > > downstream bug report for this is > > > https://bugzilla.redhat.com/show_bug.cgi?id=3D2329581 . I also filed > > > https://bugzilla.kernel.org/show_bug.cgi?id=3D219554 but it looks lik= e > > > nobody is monitoring that ATM, hence this email. Sorry, I don't know > > > where to send it that would be more targeted. > > >=20 > > > I maintain Fedora's openQA instance - https://openqa.fedoraproject.or= g/ > > > (openQA is an automated testing system which runs jobs on qemu VMs, > > > inputting keyboard and mouse events via VNC, and monitoring results v= ia > > > screenshots and the serial console). > > >=20 > > > In openQA testing we've noticed a lot of failures of install tests > > > since kernel-6.13.0-0.rc0.20241125git9f16d5e6f220.8.fc42 landed in > > > Rawhide - that is, a snapshot of upstream git 9f16d5e6f220 . The > > > previous build, kernel-6.13.0-0.rc0.20241119git158f238aa69d.2.fc42 - = a > > > snapshot of upstream 158f238aa69d - did not show this problem. The > > > problems persist with the latest kernel build, kernel-6.13.0- > > > 0.rc2.22.fc42 (a build of 6.13 rc2 exactly). > > >=20 > > > Both BIOS and UEFI x86_64 installs are frequently hitting kernel > > > crashes when the Fedora installer runs grub2-mkconfig as part of the > > > install process. In the BIOS case, this causes the system to hang > > > permanently. In the UEFI case, the system hangs for a while then > > > reboots, and fails to boot properly as the installation did not > > > complete. > > >=20 > > > I've reproduced both BIOS and UEFI failures locally with a qemu VM > > > configured like the one we use in the affected tests: 2 vCPUs, 4G RAM= , > > > and CPU model Nehalem - that's `-cpu Nehalem` argument to qemu. If I > > > use host CPU config instead, the bug doesn't happen. We intentionally > > > use the Nehalem model in this testing to ensure Fedora doesn't > > > inadvertently stop supporting the CPU baseline it intends to support. > > >=20 > > > This happens on more than 50% of install attempts, but not all of the= m > > > (sometimes they work; I've set our test system to retry failures five > > > times for now to mitigate the effects of this bug). > > >=20 > > > The details of the traces we get in the kernel logs differ between > > > occurrences and also between BIOS and UEFI, which someone suggested > > > indicate this may be some kind of memory corruption issue. But the > > > broad shape is consistent: the installer reaches grub2-mkconfig and w= e > > > get a kernel crash. > > >=20 > > > I did also try reproducing this by running `grub2-mkconfig -o > > > /boot/grub/grub2.cfg` multiple times on an *installed* VM with the sa= me > > > kernel and VM config, but could not trigger a crash in this case. The= re > > > must be something specific about how this happens in the installer > > > environment (for one thing, the installer runs the command chroot'ed > > > into the installed system environment). > > >=20 > > > I'll attach sample logs from a UEFI failure and a BIOS failure. > > >=20 > > > I haven't attempted to bisect this yet as I find bisecting kernel > > > issues pretty painful (the Fedora kernel package spec is a bit weird = if > > > you're not used to it, building a full kernel takes a long time, I > > > don't know how to do intermittent builds with the Fedora kernel spec, > > > and since I can't yet reproduce this outside the installer I then hav= e > > > to build an installer image with the kernel build in to test it...). > > > But if needs must I'll bite the bullet and do it. If anyone could e.g= . > > > guess at a commit or commit series that might be causing this so I > > > could try a targeted reversion, though, that'd be great. > >=20 > > Update on this: over the holidays, I bisected it to > > 5185e7f9f3bd754ab60680814afd714e2673ef88 . A kernel with that commit > > reverted does not hit the bug. > >=20 > > I also did some testing with various CPU model configurations. I think > > this actually isn't to do with Nehalem per se, but "virtual machines > > where the CPU configuration does not exactly match the host", or > > something like that. > >=20 > > I tried a bunch of qemu CPU model settings - nehalem, sandybridge, > > haswell, Skylake-Client and Cascadelake-Server - and got failures with > > all of them, but when I set the model to "host", all tests passed. > >=20 > > The tests get farmed out to a cluster of systems which have different > > CPUs - one is Broadwell, one is Skylake, one is Cascade Lake - so I > > think when I set the model to anything specific, it will match the host > > CPU on some or none of those systems, but never *all* of them, so the > > bug will always show up. > >=20 > > I have emailed the author and reviewer of > > 5185e7f9f3bd754ab60680814afd714e2673ef88 (also CCed on this mail) but > > have not heard back from them yet. I've sunk over a week into this bug > > at this point so it'd be great if someone could look at it. It's not > > the biggest regression in the world, but it is a bit awkward for our > > automated testing (I'll have to fiddle around to try and set CPU model > > 'host' for the most badly-affected tests but ensure we still have > > enough tests with 'nehalem' to confirm our baseline isn't moved). > >=20 > > Thanks, and happy new year! >=20 > Can you please test this patch: >=20 > diff --git a/mm/execmem.c b/mm/execmem.c > index be6b234c032e..0090a6f422aa 100644 > --- a/mm/execmem.c > +++ b/mm/execmem.c > @@ -266,6 +266,7 @@ static int execmem_cache_populate(struct execmem_rang= e *range, size_t size) > unsigned long vm_flags =3D VM_ALLOW_HUGE_VMAP; > struct execmem_area *area; > unsigned long start, end; > + unsigned int page_shift; > struct vm_struct *vm; > size_t alloc_size; > int err =3D -ENOMEM; > @@ -296,8 +297,9 @@ static int execmem_cache_populate(struct execmem_rang= e *range, size_t size) > if (err) > goto err_free_mem; > =20 > + page_shift =3D get_vm_area_page_order(vm) + PAGE_SHIFT; > err =3D vmap_pages_range_noflush(start, end, range->pgprot, vm->pages, > - PMD_SHIFT); > + page_shift); > if (err) > goto err_free_mem; > =20 Hi Mike! Thanks. I can indeed, and I will, but also an update: on further testing, sadly, using 'host' CPU for qemu doesn't really avoid the bug either :/ The initial test must have just gotten lucky. I implemented that as a 'workaround' in our openQA system and dropped the five automatic retries per test I was using as a bludgeon, but then failures started showing up again :/ So I've had to put the five retries back in place for now. Sorry if this sent you down any wrong paths, I will test the patch unless you tell me it's useless with this new information :) --=20 Adam Williamson (he/him/his) Fedora QA Fedora Chat: @adamwill:fedora.im | Mastodon: @adamw@fosstodon.org https://www.happyassassin.net