Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3335127lqo; Tue, 21 May 2024 13:58:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVs11KZTNpTguyHQThedbcBDjEtsNU6YQAnOPaxGAVY8Z2c9YZCQqpXAPEMwe+HdJLyfFwVah7KFoTutrQ4UOLsde2NFvou0XgY6fQjYw== X-Google-Smtp-Source: AGHT+IG98KbqrdN4x1eiUEA9DroW1g1ucZVzGwz8hWhXuTCuRijvSng1GLtmk/Sry45Nvn3iuTan X-Received: by 2002:a05:6a20:8421:b0:1af:cfc2:8069 with SMTP id adf61e73a8af0-1b1f8821bbdmr189221637.4.1716325080192; Tue, 21 May 2024 13:58:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716325080; cv=pass; d=google.com; s=arc-20160816; b=DJDhuTQk1Q+FxP1BmfaUZx8Hs1ixwDidRiRhjS5CJFgV6HBGkRsItYf7RWivCTnltC NTxm2STDEoI11VtxK83mwt5dabUWYZFQF9RXOr76RIscsg0BrCvJIxipRk5euCTxmeJH Bk4CqAvoGb8vo5+Exzdr5fmT7PpbFXB0L0ua/3oX12rK+SvqNmadrh1oJt6Kzj6co9xK kxigZS4cZ+vOkowiAKdNJBX+4x1Klt+KbHxJbSTSrPNkXKUKQyByqavzBb8joK07v5x8 mR7F7Rafq8osJ0HuIAE9ixGuGuJ7R6QyOOy12N9aHLiogX6sE8Gjs1JciFy7HXixYw8A YXvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=XvVQOYneXy31VQpI3gd6Ge47sV41dqcKNHKiTVXFSHM=; fh=i8taGsgHZtoZRgSGecL7V31UHz8U3cGBsoPnMmhPyU0=; b=VBW0OutbzH6RwQeIGLiOiyYBl4CybI64FbD4PRi9Oujrxajx1u3ghEYRq7pJSYoYbC fXmbY/9cHTp5nUoG1dDN3NC9uVhKVofu4hsh5XwGevlQa9CJgbD5x+HUykT81M/QWkEr eMMK5+Jh7G5LOiys5SEVZ1s9fFLiob+o9CRYrmcKS3xuHnd+AoMXaW/6hav4sy2i27zV 1h2VO5YRiviEIWpEepyjQH0qk3Gad29qA+A5gTGVzL9BYzG0ybbw/cT5W1JbvZW3pfHj C/UlqxOngiygOgTXQg8KSXTRYT610BxCUYotJN3Ixtd7qW9RRt7vmCHiUKKlWD6Ndeg4 sIyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a1luYuIv; 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-185444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-65a0e7dfdbfsi10554281a12.3.2024.05.21.13.57.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 13:58:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a1luYuIv; 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-185444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185444-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 97EC6281417 for ; Tue, 21 May 2024 20:57:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5871A149DF1; Tue, 21 May 2024 20:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a1luYuIv" Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 D4EE7148820; Tue, 21 May 2024 20:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716325068; cv=none; b=N9NfLSqrH4WVjBOI6Gpv1jyOrlQ7X1C4fTOzlqEOtYFMfEvPjBozFENYya7SpcxKOmB7Irj/dENncNnkERFRsImzsxtjq/WlQVP6EyLXUimPfh4Z3DqnWW1eqwE/BWHb7AbqaMyqzaCPirqmo2CcEGPwu2O1ZBtppsHpTpQPwvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716325068; c=relaxed/simple; bh=XvVQOYneXy31VQpI3gd6Ge47sV41dqcKNHKiTVXFSHM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=J+k3U/I0xqQTF05S2IUa0sN6WFMfbnOS7SVpuXqyPHPMYMPYALX8rH9khL3VG5adjtPPR0PVpsGE0W+N/p1S1FkKf2s7Kr4zaf/i+pjcoScnaqQ8pwufyQYuHznNwwXpvRZhvPhDOKNWi4i2I7VdShP09HSZYho2m6W++kNH+Uo= 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=a1luYuIv; arc=none smtp.client-ip=209.85.221.49 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-wr1-f49.google.com with SMTP id ffacd0b85a97d-351ae94323aso107839f8f.0; Tue, 21 May 2024 13:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716325065; x=1716929865; 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=XvVQOYneXy31VQpI3gd6Ge47sV41dqcKNHKiTVXFSHM=; b=a1luYuIvlmbLWwWyv5RDPccdKQzJp2cPCcVDKn57bsIYvXwaZYGquvnFNCkP2TC/CA YSdpHK254F0Dgp33Hf9UriNsmIFuHA+QCPZsx4MxpC6OtyWXhbGQYnW/OyQXIK06LOXQ WGcHA/o89D6e8qKrVGhu+iHfEpwIUZQ/vUbi/5YcUOChjOGuWDf2bWTcriujHLaa9Rfo D8QOlifsfKilG02btKLe/4HUvF0yGB4KUrCxMr/74JeiK2LuvuxHQukhXc7WJ91qjHpA wrm+AQCIZXyVnW8UC2rUOggfO8bJmCGCjgxtkqWX8aLKBj74rdTVIKPYctkkt1CA/cNs u6Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716325065; x=1716929865; h=content-transfer-encoding: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=XvVQOYneXy31VQpI3gd6Ge47sV41dqcKNHKiTVXFSHM=; b=l64dw9+ekuh45XV93eT7YbIF7tnB6NbCK9hVLO788JmA03K810ahsN3QLRe3IYvgHP sF3AS1GtE9vD1dBvVTI96/Aj3DCcKq/FiiJu3y/IE6nCS21N73yf0Pz2gT3oPaEfJ3U7 QR8qoDNVQVUEFWzNTr2AHuG1gS8o0XJwBd5jVxX40HYrUctBodYcvuVxl1gNFWdQV3N2 fZsw+pdS2kDXyIeAb9pUeLCtb8gk6ciKU7wZFYwX0Z9j5YJZunRJ/+uW2LuhzA2e2AXl O6RgMLlXB3AU4YalRkG788SZkbY+UyQEb8Xk0/mWTIMopwSK7t1ChTAA1iPtZYBDoerV b90g== X-Forwarded-Encrypted: i=1; AJvYcCViMqwE+ff/ErO04LV2HRR0isIKCyMBXYSdZPPgx5SbVCjSoSKLISFbCR3VJkcSYPC47JyX/88hBNB2fcte6yoIGO2aB0J6p8XNjB4r5GnF3+11q9dpzn7CcGb1Pbi+amVcgTmyP7X7HLQ4ivfiVmY6u154Lks9r9WrQSoBEySv+lDUhLxCCxg+dFaltD/AIyZ9QOFmp7rEUvwvWGpoW4pdEOw0maszEVG8kKp0WA3aR03vTGePWjshxyxp X-Gm-Message-State: AOJu0YxpvnlLCE+r/vbk52NQiCyMwUG+l7F+xEWNZdvWbJsdeDROWtg/ lwFSvC6h8/DtSLrVgwZUL9tIAZXtkv4B+AeGSUCdXCLZfA0LzxlBhnsjKpzAPE/EKjM/SGJP5r2 bpW6/AzFfwUfoY8hBNvJqyzGMVwI= X-Received: by 2002:a7b:cb07:0:b0:418:f991:713f with SMTP id 5b1f17b1804b1-420fd319981mr86955e9.23.1716325065000; Tue, 21 May 2024 13:57:45 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240521104825.1060966-1-jolsa@kernel.org> In-Reply-To: From: Alexei Starovoitov Date: Tue, 21 May 2024 13:57:33 -0700 Message-ID: Subject: Re: [PATCHv6 bpf-next 0/9] uprobe: uretprobe speed up To: Deepak Gupta Cc: Jiri Olsa , Steven Rostedt , Masami Hiramatsu , Oleg Nesterov , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , LKML , linux-trace-kernel , Linux API , linux-man , X86 ML , bpf , Song Liu , Yonghong Song , John Fastabend , Peter Zijlstra , Thomas Gleixner , "Borislav Petkov (AMD)" , Ingo Molnar , Andy Lutomirski , "Edgecombe, Rick P" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 21, 2024 at 1:49=E2=80=AFPM Deepak Gupta w= rote: > > 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 reas= on > is syscall is straight-line microcode and short sequence while trap deliv= ery > still does all the GDT / IDT and segmentation checks and it makes deliver= y > 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 instructio= n > 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 l= atency with > syscall latency would have similar cost? > > Did you do any study of this on FRED enabled x86 CPUs? afaik CPUs with FRED do not exist on the market and it's not clear when they will be available. And when they finally will be on the shelves the overhead of FRED vs int3 would still have to be measured. int3 with FRED might still be higher than syscall with FRED. > > [1] - https://www.intel.com/content/www/us/en/content-details/780121/flex= ible-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. > >