Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2009625rdb; Tue, 20 Feb 2024 14:13:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUrKpNMPv2Fo5n8Crmha/Q4zfeGRir/nSarjczpk8QXiqeWtPhxXtKTSHExUVeVZWaexyeS6479t7hvp6YE2QTtSvlshnOwkFh5/Rbl0w== X-Google-Smtp-Source: AGHT+IFHpuXQeI1JUajU1v4Z3d3sj75tJ/FVPUzv++devWJ4kiVbXI1lZPicekOAVnRiq7kCxU13 X-Received: by 2002:a17:902:9006:b0:1d7:524:a4f8 with SMTP id a6-20020a170902900600b001d70524a4f8mr16532110plp.41.1708467220314; Tue, 20 Feb 2024 14:13:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708467220; cv=pass; d=google.com; s=arc-20160816; b=M/QcarKl3vYnsR23WzGSdcQTl0QZs0YOleQv9oNerLmpV+Q1RnZDjkYc7W8+/348IQ NkcYhmQ0VpqdsWG49FbBzzzE3DeqAncHhxY151qNAwuKX42gyU2/UvORk7XLMVXcMRYl qYWDromLv8IymfgO8fiD3coeWhDskkDc1SXzevN1sxHH8tTw42h3gyXZGJ30T4oOVBft 3gDaT50GiceoVhhSY+Dcc6TE85Y6oA6VRFdE45fRN7HLwyOVsyLAJOTuSfHWLAPe4kdV yALDkWtiIj2TptMmIvs5lLim9P9Ay76SgcDw0q0iuSykIQ4rdbjQZVWQQPs//HXGn9SY Zw1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=tbrC1YiirDZo5WRjo6LZPZ9F6/4YXywYDLbK8hkWWzs=; fh=G/K7+RlJLK0ggnNlcNzysTEJxIILVh++QViOPphlDw0=; b=sUc2TreYr3AmVc04Ecy3akQlQoiBYGhQeMkHuvF2I9kJWvyaMRj587tuM4h4AhqzrO jzVYP3wWBeSgQ2IX/aurZmb+HHjJJ1K2ohLK7ExalxGBVqql0EGTiJqjnufi50VSuRb3 6FCfSbbrUWiRP8jC1BiGrtA9Dq9eVbqPltkGvTrlEQ+ZgsRNrKHMxxBJ6yhpYHZD+gBo HgjuKP392IyNCguznx378X93yQZsEaUVmrb81qVatuPvqFuHy2WvUz5QeYs/Sudh86Ta tkHMFvV2Bn7RpTpgmUjv//QM+f9GkyEVIZGGEz1H6XWu2qarK6WeAof/CNWSkmaveLKl AIBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OKRBQRgy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-73754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 4-20020a170902c14400b001db5d0901e0si6815590plj.98.2024.02.20.14.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 14:13:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OKRBQRgy; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-73754-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 82DCCB22DBB for ; Tue, 20 Feb 2024 22:13:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28E93152E19; Tue, 20 Feb 2024 22:13:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OKRBQRgy" Received: from mail-ej1-f66.google.com (mail-ej1-f66.google.com [209.85.218.66]) (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 A8EDB152DEA; Tue, 20 Feb 2024 22:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467183; cv=none; b=kPPoZ/v/1T89t1StAkY2L+lrJJiPCY/JnoXG1e8yvCFfm060BxV212GFoY4gM978PXpbquf1vibVMPL4ytGRg/tdVocYjYt/k5QnHYVcs9iKXh450oCcVbTVLuwdQib6egitGcEmc01fAz/VUUDhLwccGQwhdQGnHg8BtZoRk8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467183; c=relaxed/simple; bh=NMnvtcFQbtH5ja7Aet4YcIxkr6TQTCFMy2RG04JdvTk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=frmnfStjg11vhm/eFSiusxPMv9F9LJqHw0SwKgCr4xXUe3N1Ee7QMKv4I/hObcv1ngaPGhNKLCplHlxVdaCf5/4VtY6sfk3mp9wiBShPaqAwbAHygfJiPeKkDIuC63R1fkYdu9ndYa39U2dSjECsXrMYLjKokgjyg6J26SXO2ec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OKRBQRgy; arc=none smtp.client-ip=209.85.218.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f66.google.com with SMTP id a640c23a62f3a-a3d484a58f6so795979566b.3; Tue, 20 Feb 2024 14:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708467180; x=1709071980; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tbrC1YiirDZo5WRjo6LZPZ9F6/4YXywYDLbK8hkWWzs=; b=OKRBQRgydpfgGkqkaDNnTHko/ZrYOMdZTXzt4nsOxecdgjZ3eFu5C+xTqwIQjUMwcF NFivwIGKSg/kKmbF7RdpVj9FKvphKDVr9wzB2if1W0k993ct1rhpxV8FmPnzPyqMKwiN DkMVNLmiqyjdLGD2ZbQ6nQEQ8yM38J4NJQDAd/nbnN8id9wWFF73b8BLHInUPNu3ISjf tLBCYfC+3Dlmi0toUECRuyVS9YrAYc9qCUQoQEYaU9Sm3rzQBI8YETnkNK5H0SnPtD9a zX4hokkP0FDib9PD0WQvZD5pOUwkzE6WNRnoU3ImDJddUX3//g5q/Aizr9MM2f45LILP /YUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708467180; x=1709071980; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tbrC1YiirDZo5WRjo6LZPZ9F6/4YXywYDLbK8hkWWzs=; b=YZng+MoEt0NDvEHruuwvS2lONTD6/s+2/rALcS47qB+DGoa6NgECXvMyQx6Q2wEGxR WOlM1SC9KnDyE1YGuKTXbk3sPJcWBmGxNRGbBjAbES/NKYlZAd8gu2t+LyP+PyyTxQ6l XiIWXIxCmqbY+Tkr/xH7zwjREzPbvFjVza1/5T3cvP9WqnI/KPerFRNmzRC6qQlSs7hg zzaDDlifYsv9BGMlEWuE/X7cvQgJZjqCBvCorha7UUnVnu0/AjKSKoxA/+BF6zfPGFwH tm/mn4mI1qEWLPQUOCO49tUVJgaB77HwbblRbsEQmsvRiQ6CJXmwk4EalOztR3hTxS+K oGyw== X-Forwarded-Encrypted: i=1; AJvYcCWiKf1S9J3qootWee0ltBu2/oeji5b7KzEZpWCNXYKV8HjjvK7bmjN0QXrwNZzKHkR+bgKm8o0mr8SjmC/MHGvaIUNsL3or1j7TjR6IxuKUTOQ+RkLexRXlqkZjK+3DzNPJ X-Gm-Message-State: AOJu0YzMUviVn61fxBNr8JG/FBRrBOaFcvbfMcr/BgBvpHfKbFNVIDnr VFV9XgCDj3QdniO+96sJE94IhvWlh7jWoqdXj07ijgE8ksBQ7yYpIJtDoM5z869p0IST0iYn+T8 yBcEBvjyzzGt/GvImfCBVg1h3mIo= X-Received: by 2002:a17:906:b24c:b0:a3f:1cd:69bc with SMTP id ce12-20020a170906b24c00b00a3f01cd69bcmr2102892ejb.15.1708467179708; Tue, 20 Feb 2024 14:12:59 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240201125225.72796-1-puranjay12@gmail.com> In-Reply-To: <20240201125225.72796-1-puranjay12@gmail.com> From: Kumar Kartikeya Dwivedi Date: Tue, 20 Feb 2024 23:12:23 +0100 Message-ID: Subject: Re: [PATCH bpf-next v3 0/2] bpf, arm64: Support Exceptions To: Puranjay Mohan Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Zi Shen Lim , Catalin Marinas , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Thu, 1 Feb 2024 at 13:52, Puranjay Mohan wrote: > > Changes in V2->V3: > V2: https://lore.kernel.org/all/20230917000045.56377-1-puranjay12@gmail.com/ > - Use unwinder from stacktrace.c rather than open coding the unwind logic. > - Fix a bug in the prologue related to BPF_FP (Xu Kuohai) > > Changes in V1->V2: > V1: https://lore.kernel.org/all/20230912233942.6734-1-puranjay12@gmail.com/ > - Remove exceptions from DENYLIST.aarch64 as they are supported now. > > The base support for exceptions was merged with [1] and it was enabled for > x86-64. > > This patch set enables the support on ARM64, all sefltests are passing: > > # ./test_progs -a exceptions > #74/1 exceptions/exception_throw_always_1:OK > [...] I think this looks ok, would be nice if it received acks from arm64 experts. If you have cycles to spare, please also look into https://lore.kernel.org/bpf/20240201042109.1150490-1-memxor@gmail.com and let me know how architecture independent the cleanup code right now in the x86 JIT should be made so that we can do the same for arm64 as well later. That would be required to complete the support for cleanups. I guess we just need bpf_frame_spilled_caller_reg_off to be arch specific and lift the rest out into the BPF core. I will make that change in v2 in any case. Just a note but based on our off-list discussion for supporting this stuff on riscv as well (where a lot of registers would have to be saved on entry), the hidden subprog trampoline could be a way to avoid that. They can be pushed by this subprog before entry into bpf_throw, and since the BPF program does not touch the extra callee-saved registers, they should be what the kernel had originally upon entry into the BPF program itself. The same could be done on arm64 and x86, but the returns would be diminishing. It would be nice to quantify how much this saves in terms of costs of pushing extra registers, before doing this.