Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3332132lqo; Tue, 21 May 2024 13:49:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXc5X43VClsqXoSIvollGjdXcEw/MpaThWqQ6cj3Qe3blgeJF2LW5PanH3JYnycupOUO+Q2uFP9cRZkM2TvYbJ9MWpsrbqPimOfU5vM7g== X-Google-Smtp-Source: AGHT+IEx4vgZcYfivZPecul6BwIR+bI3WmDhMIWJpajUmpFz2E3XSU/hmrzUrK2FPXxvQyCdxnkW X-Received: by 2002:a50:d61c:0:b0:575:2a03:8ff6 with SMTP id 4fb4d7f45d1cf-5752b4c9117mr9334303a12.16.1716324568499; Tue, 21 May 2024 13:49:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716324568; cv=pass; d=google.com; s=arc-20160816; b=GVNO7EPONz0bwjm98y2gj3cSoYiPdksh5868xbDybTEXOqcx4FEupY9IrhUQ6eP8s7 Lx3/fSkeNL+8kfmRHz/PXOUb0EnjyMDs2LDKJwotYGVmRn5D7aJawXEeUwiGAo0ylRyo wEABaY/+29rJ09nKMrQJYvyTcftwWc9PfzwMiZvxbx+4OKvJrQwCoszaIY4Jp83fk7zc zPhV3EYbey/D1OtYyG8bVflvZr5mbsnzhCINO8AGhe+ksQ4H8Pr/ndf3LLKG+nkA/St6 CxmNet+gUtmf9GK3VH7ihPHj+1wYcEOf6sLi8YzCoAhz9JL3ty42yum3pbkzfE+XGHRM f1QA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Rx+dQv0EXvgLDA60wWUrjQl9mWisglv5nVrYagP1xdM=; fh=NHZQoYvWgeQihRJxuNE6dy07TdM6JFiwIe/SY71FQrY=; b=TA5wwGwOsogvY4MUkdx8ZjcjV1/958R1806W+yHc7awp2yGDXxYjgReJg+tetPLEbz GAg+NDQHRnR0fr6t8OW2Igt0VUC6Ew1M6cVrQoot2KXphGe5lXSMkHICUGcPDVo7/q2A GS+FrXUg73j7eNOREUf4OnTEGsf822axDSktuFeHJQDdUi/qFm843FvbTDT/PD7muKHT 3vm68L4+2PmOhPyjZCcdqWpiuWJo5tc4On5oWe6ZJUaPWLRv0zXZeUjHe4azfrhvla4y Li6FHthOKLHx7VoLTYiVhZOlCicgM8AylOOMlwMyZs1THHlfMtg5Eo+9WhInAbM7vBSy nCng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=bGOtEg9z; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-185435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185435-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578239ec47fsi1060427a12.397.2024.05.21.13.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=bGOtEg9z; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-185435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185435-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 387981F21902 for ; Tue, 21 May 2024 20:49:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0846B1494DD; Tue, 21 May 2024 20:49:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="bGOtEg9z" Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 97ED81494B9 for ; Tue, 21 May 2024 20:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324547; cv=none; b=bxWb5gdl167CLKnRGtVjbrfSThI4tBdY+Z6uwCmkk/5uWSZU8vaLBDzphTaB8HkuJjuaI0g5btDngutZh1p/9kKe7wb+65jZhjOnFj88n03xQertn0NeHsQ3wsRLWXMDzMieSD5W9mPOzG2t2gPI2joi2l60oTgoRCIQ1NLHCm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716324547; c=relaxed/simple; bh=693jQWAREfUdV/HbHgjOUtkEmsrn6/m+v+a7zyIHVAs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hUbF+rSvDTx94Z9Lam9vPfLysqshzXrg/hNsHi/SbjyksJq5QjaRyuB2Kmcf+0JJRU1DJO7NFRk88v40NpKWMccw3AD3zKMytahCOXrYUjNNqQoqy6iNzv8ExncfFpuyLgWfaMsGruftVub6/uo7YDYAle/rrILpaUbVdAAExZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=bGOtEg9z; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-65c5a29f7f0so1764839a12.1 for ; Tue, 21 May 2024 13:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1716324545; x=1716929345; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Rx+dQv0EXvgLDA60wWUrjQl9mWisglv5nVrYagP1xdM=; b=bGOtEg9ziXoNqwXkpqdc4PZ9a/dAbvsOdVOv6Ku83BXj1uzMRgUexqjLybC6vjdwuF vyl5BeGOLjczKNcCkP/tIjHejxsaGNV1t1mptXMu8OHmNVQUVRr1aFPnnrhS+z7u9rSi TyEsregyM6IsQNW8QbmTkWsVfnJ3mZnyqD95NnLJ649AXvr958c52PadJUiNq6PoD9aX 5LE815kSLpBWQ9xLvQSEDW9VCUFIgrYXOiFuQ4+2lTiTvo81nZFHYjvdMVPDT7ZwcZb8 mHVe/kOcJg60Ee14FH4DclNTU8v481dskopZPkQVXtpuo2pu6aNhYA05mXo3veNx73Y9 WMDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716324545; x=1716929345; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Rx+dQv0EXvgLDA60wWUrjQl9mWisglv5nVrYagP1xdM=; b=cL3dcWtXinD4ffDKOgPYJsozbhEgPVIqVh3JLFKUa9EKhWVZLx1/FVLyMWA66CGibO VdWR6mdNmJJMEOGMrGllNs3Csb9C6M1OJ2rcgNkDWk9DstcSJlLhD3vbVH62qWjWmRgu Vdsy38RrXodblsVM3ERLKBt652DA3ktu54kYlnTiE3Jb3Bm5vsrCiIV49bf8964J0cvQ iKnNu5xgFsGoWOORdQxlX6N4ebjbYazTg5nBxmP+DSnwz8Br8nLZFJVBSzKq9hqqhiQO R/KBJUPYyqcn30djAgoHuqfgL8KtxdNyBux15Oz+krNJUJVsemMLF79je7w4vWb5wUHJ fa4w== X-Forwarded-Encrypted: i=1; AJvYcCXfusYsFY9SGyWbDuZavI7b8b2+ySWjxL1T+KDPt/4MkPsQ9EG8x0q1/ImiDX/l/IESFpHQaucx+YNIgVhu+w26AM+KuuguDlLDTo2Z X-Gm-Message-State: AOJu0YzX8sW9vgCz+FV2scAOfU6rB7pbjiAjgViipX+dAAqODC5EYYkI YeOEVBXsAlEhW/BFAoao1pXIBCZ9xVUrpc4K1a7qJVOA5wm/ObEzmHtVDsVo76k= X-Received: by 2002:a17:903:8c6:b0:1dd:bf6a:2b97 with SMTP id d9443c01a7336-1f31ca37710mr787045ad.60.1716324544792; Tue, 21 May 2024 13:49:04 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f0958d1e3csm114310545ad.191.2024.05.21.13.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:49:04 -0700 (PDT) Date: Tue, 21 May 2024 13:49:01 -0700 From: Deepak Gupta To: Jiri Olsa Cc: Steven Rostedt , Masami Hiramatsu , Oleg Nesterov , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, x86@kernel.org, bpf@vger.kernel.org, Song Liu , Yonghong Song , John Fastabend , Peter Zijlstra , Thomas Gleixner , "Borislav Petkov (AMD)" , Ingo Molnar , Andy Lutomirski , "Edgecombe, Rick P" Subject: Re: [PATCHv6 bpf-next 0/9] uprobe: uretprobe speed up Message-ID: References: <20240521104825.1060966-1-jolsa@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20240521104825.1060966-1-jolsa@kernel.org> On Tue, May 21, 2024 at 12:48:16PM +0200, Jiri Olsa wrote: >hi, >as part of the effort on speeding up the uprobes [0] coming with >return uprobe optimization by using syscall instead of the trap >on the uretprobe trampoline. I understand this provides an optimization on x86. I believe primary reason is syscall is straight-line microcode and short sequence while trap delivery still does all the GDT / IDT and segmentation checks and it makes delivery of the trap slow. So doing syscall improves that. Although it seems x86 is going to get rid of that as part of FRED [1, 2]. And linux kernel support for FRED is already upstream [2]. So I am imagining x86 hardware already exists with FRED support. On other architectures, I believe trap delivery for breakpoint instruction is same as syscall instruction. Given that x86 trap delivery is pretty much going following the suit here and intend to make trap delivery cost similar to syscall delivery. Sorry for being buzzkill here but ... Is it worth introducing this syscall which otherwise has no use on other arches and x86 (and x86 kernel) has already taken steps to match trap delivery latency with syscall latency would have similar cost? Did you do any study of this on FRED enabled x86 CPUs? [1] - https://www.intel.com/content/www/us/en/content-details/780121/flexible-return-and-event-delivery-fred-specification.html [2] - https://docs.kernel.org/arch/x86/x86_64/fred.html > >The speed up depends on instruction type that uprobe is installed >and depends on specific HW type, please check patch 1 for details. >