From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60D8B2673B0 for ; Fri, 15 May 2026 03:30:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.222.44 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778815857; cv=pass; b=tgoldoahZ1JF8uRkd2kff7Z6dcJEhhSirlT8oVZpwn2DO5A3hEDdF3agXvJKM8ytoXqp7T6zgccLGOgrDdJ7ceYOVHbt9mJLrXDAuGZtunMgUC5OLrnEaOF+RQKlgaVHYW6o6f9V5AXtlXIoVMrJvE44LTYLkXWAQ8Lnr+oeft0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778815857; c=relaxed/simple; bh=SyLq6l03Jbv77EGiuhHzi5QbP6fsi2oew2GbbqSsrAY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aBbqZmGz2v5zK5qmyBwROHTNIm1EFD1KOVxFSiE5GpvFEHXLdwk7F62+4w8yqeEHlLQDt72nX6xly/wcMOLgDzVu5z/Of9hedk0Ge7Q3gQmuTgQ9+DrL0FzH+pWpGUSS1h8lbyluW5xTlZPakrNS77XV9T5EyXdbk4amDKolbHk= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vEVQRir6; arc=pass smtp.client-ip=209.85.222.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vEVQRir6" Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-94e2ad66abcso3080621241.1 for ; Thu, 14 May 2026 20:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778815855; cv=none; d=google.com; s=arc-20240605; b=XYj81P9TxETZSzkxHuDRko34G9+yCoTYbJw3WAfP4Nx6nMF/Bgo+dLvSujpZIWlGKd RqYpAs3Ee6A1jzmPO5XBV4o1sRfa0SWQwc0yrhKsrpkNSUP8Pv9R4GuvG+DRCr942DCp kwwsLxUiA7HCpLFz697t3aCipUm9aQPCo3GnPxNkkOBRfAWJFlaa0kBXsuB1rH6SCztB coEzlsKNfcvfCHOPuvlPq5D5wN2cbIb2jsh0PaYepE5LmBRx2+WJKMmmX05prc4KnQZN 9t8GIJ4kSS4kogwNwyZ2hhMZdozAJ85gBhjmQdMXN8r1Ex6TGyBjT3ysV7uQ0vsmE091 +tkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Fop7pjzudS6D7wpF5+eicnKfmSm+O2A+twiw3O1334U=; fh=oNj3NhfBT+B2N73FzcsFMYSPXl7dO4jfmuPzHI4kPhw=; b=DEXAjgG2RtfMuciW5WSVCTjdCCx1tK0zJt4MOhvaP1EtF+2a/DhuwejPUq7TqrpZKT VFZ38/qUd71rCRa7+K2wWngN0Van2fb1PyWxzLOUm5VIV6ldcnSD/nNpZ8AxmCdeNE0o oCAM57qYJ7PKV+H6+uBwLbUs2AOtd6V/gVvac93tkDhAu8kM5Ur3tVaWPsAhKTfjyXdK W5uvQpmgPC8w04AYMBw0TmY1TVZpoZnMw3aqt/JO04m3Drq1I2s/T3NWKDml2owztAT4 swSTEDqOV1Iwk9gL8uPhgYQ3ncYSGRvcYT6pJQIapVQE84eOcFlSk53wkqkuW9B2gd17 ad3Q==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778815855; x=1779420655; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Fop7pjzudS6D7wpF5+eicnKfmSm+O2A+twiw3O1334U=; b=vEVQRir6Acr0E69jX1tzjWAC7tpXbJC5B78UOSM6fTOlnx9qQeMsmNxD5li+7fhIlW 7l1CsA4EGpj3fyrvKu9q85od5sXrdS+RJgyd2fIXBk+gWGo6ii7kMQaFW8fHrOiGpKKE pvBqIwMwQ5fbscEUrzW0xfra7vKboxZqZyVXQmB/pbKGsnF4zORbNgPC1j3zcwbMJlSO oR4uGjYPUwM9hoBbUpJE4fXHpU4hZpo6moXesZlFmRK8rLlCTXo8JIkchCFqpVFtqg32 38Nbez5yEXz0RdsgGKjWpdDqvqbyhewsjhbZGEXtc7ruoaoPV+dK16uXU178UW1IqBU8 Y8Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778815855; x=1779420655; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Fop7pjzudS6D7wpF5+eicnKfmSm+O2A+twiw3O1334U=; b=Q0mxmxO5YE9geNqKK0r0tNBp0c6mu8i8eCq1/lOAneS0F84uzDzvBV8iACmINrTrK8 uISEma0wwtZuxoAsgClgr3HdqMC84PCNZfaoqyJ7Bhw9a7ML+kCEYRcSJA5dyreElqad eys5GcwrzwHY6K3efDjpXLtZW03tjt1kETjeqjkPPZazKTslDHIlP65qCTOBhzjrcJ3m LuIJYgGTmzSK4rqa4d9RjBdzXm+J6s8YFcRNbKHAZLyZGW7xp2HY8/Sg+FULMKBaGert pQdiGMtnucJeGojAoahMhdItJzaXDYN3t7nn48hJ7DlSexSP/4T0NMA/erZmGBeCFpXG iMZA== X-Forwarded-Encrypted: i=1; AFNElJ80s8BeUlitkU8TuVhktuX1BZKm6gB18rw+aq7c2bLgiOFGWE8hf5NUCzXIXqTlyllCT/AwUav0leIEzro=@vger.kernel.org X-Gm-Message-State: AOJu0YwWp5alOow0pu4Mkr+QNDznQykNDcodj0GYLN4oipTsxmDHuY8z VBee5PDdWkMopFzc05m2BMVXwI1V5Slz0PLO+ieFCBA42x9A+rZ03C8yrMzx9zOs/+oZK1W3dJy INrzTmBWFWP4rxN0SAbHvg09DsHo9hPoj2q//6ETk X-Gm-Gg: Acq92OGHIdkbPlVG6zUcy41DcTTNUl8YI04ve4tcHY6URuWpWPwp8kp3eJu4WNgFCp8 3QGa7yd23mlmxw89YAwulNyzyfsg2rp2d5AccZDYSqaEhcbq0d8zNWqpoewTNYC+4/ANcGEH15n KvOv9crrPCQ6ueKibEkOeYNfk7zGvBQRuMT7DZA7xI8YyK5EUgebun9sqxfhYoWQ0CZILjDIqG5 Qpjx20cg1shUODadrJVWi4NHvz7dF411XyoIcTk+ZOq3SmPbmZ8+bbpHqOdnxWBuSeA5YoYOul3 6nycgO3SQglaVMTW2w== X-Received: by 2002:a05:6102:1625:b0:631:2dc6:2f5c with SMTP id ada2fe7eead31-63a39b64e5cmr1060585137.0.1778815854791; Thu, 14 May 2026 20:30:54 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260428183643.3796063-1-dylanbhatch@google.com> <20260428183643.3796063-4-dylanbhatch@google.com> In-Reply-To: From: Dylan Hatch Date: Thu, 14 May 2026 20:30:43 -0700 X-Gm-Features: AVHnY4IjCZOnrcRB6EchAvXRAgsUMT_fI25-8QVgnLQEfY3rQYsW4VZ_r7tS_bA Message-ID: Subject: Re: [PATCH v5 3/8] arm64: entry: add unwind info for various kernel entries To: Mark Rutland Cc: Roman Gushchin , Weinan Liu , Will Deacon , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Steven Rostedt , Catalin Marinas , Jiri Kosina , Jens Remus , Prasanna Kumar T S M , Puranjay Mohan , Song Liu , joe.lawrence@redhat.com, linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Randy Dunlap Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 29, 2026 at 8:26=E2=80=AFAM Mark Rutland = wrote: > > Hi Dylan, > > On Tue, Apr 28, 2026 at 06:36:38PM +0000, Dylan Hatch wrote: > > From: Weinan Liu > > > > DWARF CFI (Call Frame Information) specifies how to recover the return > > address and callee-saved registers at each PC in a given function. > > Compilers are able to generate the CFI annotations when they compile > > the code to assembly language. For handcrafted assembly, we need to > > annotate them by hand. > > > > Annotate minimal CFI to enable stacktracing using SFrame for kernel > > exception entries through el1*_64_*() paths > > I thought we were only consuming SFrame when unwinding an exeption > boundary? > > We shouldn't be taking exceptions _from_ the entry assembly functions > unless something has gone horribly wrong, and so I don't see why we'd > need CFI entries for the entry assembly functions. > > Am I missing some reason we need CFI entries for the entry assembly > functions? I strongly suspect it is not necessary to add these, and I'd > prefer to omit them. I believe the el1 entry functions are called in an exception, and are called before call_on_irq_stack. Example stacktrace segment: [ 262.119564] handle_percpu_devid_irq+0xb4/0x348 [ 262.119913] handle_irq_desc+0x3c/0x68 [ 262.120196] generic_handle_domain_irq+0x20/0x40 [ 262.120678] gic_handle_irq+0x48/0xe0 [ 262.121005] call_on_irq_stack+0x30/0x48 [ 262.121412] do_interrupt_handler+0x88/0xa0 [ 262.121779] el1_interrupt+0x38/0x58 [ 262.122089] el1h_64_irq_handler+0x18/0x30 [ 262.122617] el1h_64_irq+0x6c/0x70 [ 262.123159] _raw_spin_unlock_irq+0x10/0x60 (P) [ 262.123720] __filemap_add_folio+0x200/0x580 (L) [ 262.124145] filemap_add_folio+0xec/0x300 [ 262.124674] page_cache_ra_unbounded+0x128/0x368 [ 262.125338] do_page_cache_ra+0x70/0x98 [ 262.125875] page_cache_ra_order+0x460/0x4e0 Here, el1h_64_irq is the last function that appears in the exception stack before _raw_spin_unlock_irq and __filemap_add_folio are recovered from the saved PC and LR, respectively. So we therefore need the CFI annotations in order to unwind through the full exception boundary. Is my interpretation here correct? > > > and irq entries through call_on_irq_stack() > > Needing some sort of unwind annotations for call_on_irq_stack() makes > sense to me, but don't we need something for other assembly functions > too? > > We can interrupt things like memset(); I assume we'll treat those as > unreliable until annotated? While looking into adding these annotations, I noticed a pattern where a sibling call is made to a local function: SYM_FUNC_START(__pi_memset) alternative_if_not ARM64_HAS_MOPS b __pi_memset_generic alternative_else_nop_endif mov dst, dstin setp [dst]!, count!, val_x setm [dst]!, count!, val_x sete [dst]!, count!, val_x ret SYM_FUNC_END(__pi_memset) In this case, do we consider the stacktrace unreliable since __pi_memset may not appear in the trace? Or is this not important because assembly functions cannot be directly livepatched anyway? Thanks, Dylan