From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5B5D202C37 for ; Mon, 16 Dec 2024 10:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734344016; cv=none; b=Gd4P40aKPSMGIp1e6k4uFVULGhYVfNmSaXrZoubB/wVZzFmM5MkO7MyAjLbZo9ajMf/zMwJVZq19Ossp9TzZnPDVWyoqB/A8+V/kYovodNYoPn6siH1lVUTMA7DvEB4nEtyqIEU9bAx4XhCjsi/Wqh5SxuBQiLKERMXO74wNcH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734344016; c=relaxed/simple; bh=MQK+wr+Xv+qZBf/YdEN80HGnJtSnQGXQbvv3yurqpYU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AnXK/LQ2N/0lKc2V4f+BKQnvqFbb4vvHDFi3mudXqqj/z2jNtjfuBODOt/N7CQbFxZ+conLteEawEttRa7DTKzprR8J7800Dy86QYl5A0BR/kfXW1zLCihn6sTrzxnZqJBAKrdacI9chsoiueXfo//WXzh/8JKH2+ZkkU70+VAU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VbUrbRrT; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VbUrbRrT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734344013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MQK+wr+Xv+qZBf/YdEN80HGnJtSnQGXQbvv3yurqpYU=; b=VbUrbRrT8RAQ47GOkWYDP26lyoabCbtGpUCjWVjbVEhHJ4g6Iviteltplo2hqvTaeGRaSt GoTsY2vEW481DUR0WOItklFQQZF/nf50Kf+dkl9eZ6W2MmSBtwqF/E6e6gfcKnrpuPloBi YvuC281TJskQsLXF5n+q5WaqzWcYevM= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-QwhyTaoPMDuCud5HOOU3ZQ-1; Mon, 16 Dec 2024 05:13:30 -0500 X-MC-Unique: QwhyTaoPMDuCud5HOOU3ZQ-1 X-Mimecast-MFC-AGG-ID: QwhyTaoPMDuCud5HOOU3ZQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 572D61955F45; Mon, 16 Dec 2024 10:13:28 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.224]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 4E8191956088; Mon, 16 Dec 2024 10:13:23 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 16 Dec 2024 11:13:04 +0100 (CET) Date: Mon, 16 Dec 2024 11:12:58 +0100 From: Oleg Nesterov To: David Laight Cc: 'Jiri Olsa' , Peter Zijlstra , Andrii Nakryiko , "bpf@vger.kernel.org" , Song Liu , Yonghong Song , John Fastabend , Hao Luo , Steven Rostedt , Masami Hiramatsu , Alan Maguire , "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" Subject: Re: [PATCH bpf-next 08/13] uprobes/x86: Add support to optimize uprobes Message-ID: <20241216101258.GA374@redhat.com> References: <20241211133403.208920-1-jolsa@kernel.org> <20241211133403.208920-9-jolsa@kernel.org> <1521ff93bc0649b0aade9cfc444929ca@AcuMS.aculab.com> <20241215141412.GA13580@redhat.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 David, let me say first that my understanding of this magic is very limited, please correct me. On 12/16, David Laight wrote: > > It all depends on how hard __replace_page() tries to be atomic. > The page has to change from one backed by the executable to a private > one backed by swap - otherwise you can't write to it. This is what uprobe_write_opcode() does, > But the problems arise when the instruction prefetch unit has read > part of the 5-byte instruction (it might even only read half a cache > line at a time). > I'm not sure how long the pipeline can sit in that state - but I > can do a memory read of a PCIe address that takes ~3000 clocks. > (And a misaligned AVX-512 read is probably eight 8-byte transfers.) > > So I think you need to force an interrupt while the PTE is invalid. > And that need to be simultaneous on all cpu running that process. __replace_page() does ptep_get_and_clear(old_pte) + flush_tlb_page(). That's not enough? > Stopping the process using ptrace would do it. Not an option :/ Oleg.