[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v13 04/14] xen/percpu: defer freeing per-CPU areas after resume failures


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • Date: Mon, 16 Nov 2026 18:16:41 +0200
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=I6ch8DWjY1pnRn8ttiHOVdVvtK6sYgApQEC1gXflcc8=; fh=6IZGWk2W51j8C0yLF6Z6rSSMkcfTI7E4hWu/LLuh/YI=; b=QzCG3VpWqQF2d4ktWIksONnG1gh9R+f8xxidEYGXm+KoYZU4S8DmqWsKuLa8cYAgcL dOv5S+rnbvZxtO0OT6OhAp/XeIEDMmbsNpKr2dreaAu1mljpeKGlxnOjz2CF2sZZ4k9r GeAiAkPep0lkX5ClAhKfYG9sC0/D4d4nqtgo6KDcY0IDNWnaBZZUcSVWcvIAXXGDRSg8 IjvkAy1C/djPIg/1GStu1hYXtMKzW7xBoRpbolMuKy/dwte/7yHyRdjX74c3UU6NB1Ii zQASEleQ/brLiRjgah1jjR3pn9yz8UT+V1Dne0fTYfWOTeZ6HQ6mRvY1NS7gPZ1d4pn9 +Fqg==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1794845813; cv=none; d=google.com; s=arc-20260327; b=fyG/X/BIse6AzG10cYxucnTaCUekaU5SEnon0x/XOBj9wgkKR+HxOo7+PejFDbOCn9 D99bgE9uU8IPvdVZOKV01ZnSsMU4TgABHCDuToiq2IT7I+8qOIgxGzY6bI8LNWNevDBc Vqw2Z7aPUwoWFsmFowwpt+qoFD92e2fdBGzzP8UTDO74Qjujb/LgpuqZ/pHjg+vcHdty 3taVT8s6nQ0rND6j33ZijrbfXn5SL1IdvcgpkYlWfRkJcBHSSTaNSvzXnGRLDrk0oC+B TpMDlFTccaRRjHRxXW6mTF9MosJ7Op7L3+lV3p3ttOQGKrG3M6xOVePMkly0FFnWFP7y lH8A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20260707 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: Mykola Kvach <mykola_kvach@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 16 Nov 2026 16:16:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Nov 16, 2026 at 5:58 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 16.11.2026 16:15, Mykola Kvach wrote:
> > Hi Jan,
> >
> > Thank you for the review.
> >
> > On Tue, Nov 10, 2026 at 1:03 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
> >>
> >> On 27.10.2026 22:05, Mykola Kvach wrote:
> >>> When a CPU fails to come back during system resume, cpu_up() sends
> >>> CPU_UP_CANCELED. After trying the other CPUs, enable_nonboot_cpus()
> >>> sends CPU_RESUME_FAILED for the same CPU.
> >>>
> >>> On architectures which do not park offline CPUs, both notifications
> >>> queue free_percpu_area(). The release metadata, including the rcu_head,
> >>> is stored in that CPU's per-CPU area. The first callback may already
> >>> have freed the area when the second notification arrives, or the same
> >>> rcu_head may be queued twice. The CPU_RESUME_FAILED callbacks also need
> >>> the area to clean up timers and CPU-pool state.
> >>
> >> I think there's another change needed, for the change you presently do
> >> to not cause a leak: If enable_nonboot_cpus() calls cpu_up() for a CPU
> >> whose bit isn't set in frozen_cpus, and if that call fails, the CPU
> >> later wouldn't have the CPU_RESUME_FAILED notification sent for it.
> >> IOW the freeing would then not happen at all. Question is whether
> >> simply setting the bit in frozen_cpus would be correct: Notify
> >> handlers may not expect CPU_RESUME_FAILED for a CPU which wasn't
> >> online at the point of suspend.
> >
> > CPUs outside frozen_cpus are only tried when park_offline_cpus is true.
> > In that case, the existing !park_offline_cpus check already prevents
> > freeing their per-CPU areas.
> >
> > When park_offline_cpus is false, CPUs outside frozen_cpus are skipped.
> > A failed cpu_up() leaves the bit set, so CPU_RESUME_FAILED is sent.
> >
> > Am I missing a case where this patch would introduce a leak?
>
> No, you're right. What I'd like to ask for is an adjustment to the last
> sentence of the description: "does not take this release path" is
> ambiguous, because the notifiers are the same everywhere. What's skipped
> (for both of the notifier codes of interest here) is the call to
> free_percpu_area(). I'd appreciate if you could disambiguate that.

Thanks, I'll clarify that in v14:
x86 skips the call to free_percpu_area() for both notifications.

Best regards,
Mykola



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.