Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp368602lqo; Fri, 10 May 2024 02:19:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBCE5GSGt5ZVj7ssYBX/Qkl16MmTjaiX0+zvWnp2DiIVs0DVr6V7AveHO6rZ2icAdtKsWaJOxdJO/l/C+KM4sxfw9L42oHqpFUFIztWw== X-Google-Smtp-Source: AGHT+IHtF3FsctkgrowL6sV1O+2uC3eJdZu05nczL05u3QfHhcILw54ppTsz5kY1Y2Osz3CfmWmS X-Received: by 2002:a05:6214:43c4:b0:6a0:caef:3be2 with SMTP id 6a1803df08f44-6a1681f8115mr20340536d6.46.1715332780073; Fri, 10 May 2024 02:19:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715332780; cv=pass; d=google.com; s=arc-20160816; b=cJuRxdj2Kq+n5YtgBauCLQQhiIXc7GgXv0Iuhqa7d5wkjAt999CvuYWDyuuVdTW+ZA CVN6yxSkchK5f8DTTkuObHyEpeQaiMqD4AEV5JSofbp+9kDVXQ8P7GvbrxrjnWo785ZL 0rEq8G+9Uf1keFyAVsrISr6i4m0U16Tw+9gcJB9wxF0B7D9VVOE0n7uhh3Nk/l9VwkiI MQXnXXdQQRnCtFiohH7PgE1sQzVUDvuOPoiNxcOLO5LDPz6pazVvx5oAxADy/zKPuGBL IW4X7gURDXEAFuJT0AZ3amoM8Nn2l9XsGPyKAp7qUOxi/W+lzr1aHOYHzYuN8dqqYoat 9BGg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=w0K49mR3hMRsaS3+WXflIxtYT2lACdM2QgyeFZGMIw0=; fh=i/z2+Ipl4gZXi/wEif5AZ76gx0DSCN8hR9Wz56iBp8k=; b=jyDc1odLRPcwiz3TsS9hNg5GQfsJD1tgzxLN4jnlubhFbQn8GGWrQ9AAfu4fl0Vtx/ b0SeHvpwkc95bH+edkIDW71ZXDftO3kOx3XqRj6V4WQ+vRkiIgrhjhkTivQUBrPhkqM+ tcBajmJSD3g5XPoeyNZWdukyomckko+NDlVHs2qgYVsx5HKoapyK7U38QJR7lYOcPwjf NBsZ3/ysuIS5+bs5NEGlmOnNKYTGsSigYAOcUqRONjQuudvZ9IMLgzYXC0+NsCwBPdXT +/sZU9suPu1I7JVhnoXhC+QBDc281ibBa/PbqkdgUWtof11yEPPhEFD4RNzf0CP+E9GV bCzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RTbhV8fL; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-175520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f1d754esi32949976d6.44.2024.05.10.02.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:19:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RTbhV8fL; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-175520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175520-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BA47C1C21BEE for ; Fri, 10 May 2024 09:19:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8075C1635CB; Fri, 10 May 2024 09:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RTbhV8fL" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 EB47F14901F for ; Fri, 10 May 2024 09:19:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332769; cv=none; b=tZ6yPa50oBw3jpd6MifVaPajuYI06MJrXEFAuN3c8DjTfVUJaDcKwC15faZkQcluvVVoe5hGPThC7KJ1EbLT/PJ/vT7sDsqynac2rlupuNN8gNlXeuNnZ5zeY9xMVxsxCIe2HBI8hO3y6jB1RZYFOLGwes5ZamU25YZ/2zCI2MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715332769; c=relaxed/simple; bh=IhFb5Pgicuh3snztn4LKPQtE1fwjYlbAD7oCTha2wuc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Pet8AtB9K9hOAe0kICYZG0NUCi+Id66xsx8ZwQ9jgjNt46Wi3D4zxdlCy0FO0T/DyjRue2As+ezEinElxfSgNIym3S1cvLPITmzV2Ye3rM0SWttr66jnazLwyhplLDnTUWjn3dsr+d7INtAYVm5MjhOSwSfFz+s4iEBee49uH/w= 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=RTbhV8fL; arc=none smtp.client-ip=170.10.129.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715332766; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=w0K49mR3hMRsaS3+WXflIxtYT2lACdM2QgyeFZGMIw0=; b=RTbhV8fLBtz3GXwCnojN5c4B+JJi5JARnbyMWZhpwOVay5nRPCDwJeBiIQSiZmUdgq9MCU em9XrnoiV65tJ4HKMnvZO0JKjf2RHlDxMXZ/iSfGs3ZWsC5lsXVqFTyA8dosmlirx1MkSX TZwnZyaynitfDVOexXE7u7x5cNq71jg= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-191-Fzh2-okgOpeDjKw7uivW8w-1; Fri, 10 May 2024 05:19:24 -0400 X-MC-Unique: Fzh2-okgOpeDjKw7uivW8w-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-34da4921505so1035626f8f.3 for ; Fri, 10 May 2024 02:19:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715332763; x=1715937563; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=w0K49mR3hMRsaS3+WXflIxtYT2lACdM2QgyeFZGMIw0=; b=C9HjBoUNuUTGIJ7RcWDe2KPgS4A8Mnhks0McWnVKcbO13lQjV4VT3DUNVh4Dq+Q9+f Oz9I2BiVTRZUKmchSWWCpq6OkmOHJv3lFDawum92afmYYSZe8vW9KSHpz+dDCGrzlsce k+2+YM8SCBONNN6pq1/SiVLppmruoDYkwsxGba1y4iNNqSa0TeIA6UEhoEgNSObQ9hMW 1lDYIsCZjlkoAcZJGdZYt4ANnEYoiqFHUPYs9t10gXjPJ5faG9yV6ZeyVQ5NnBB4VcTR 9sQZxnBfRSsj2/EEGYJrRDKfm1+Tb+jh2uyhSL6R3zSm0CMztRpNSUb+/HbSdbr8i8KY bu4Q== X-Forwarded-Encrypted: i=1; AJvYcCU1l7M+uo3QUgHI2eWk3hHFoIy03gqHslGAnxfiCQ86nDYXPoiuErtKDH9qB8kvviu8DuDJv8XcKl79X+L3tmoqShginU0aVe7EXLaL X-Gm-Message-State: AOJu0Ywliw/dC4Zdx8XXbctVuhaGM8PAsbNg3mn/VeoFNHf9r3DUOV9f Zu5vTZwugsNNMwESWPtcb8EAk1YvRk01iJoR3U/uFMm630uWNOUBVBQu7dzN8//M5lAkWWIxNg9 GoSjkfVYvjesqJLI92lQ7a8F1UN0obthIrm0RoXpBS68869ImdXl3Ewl7BNh4Dg== X-Received: by 2002:a5d:6650:0:b0:34d:7f17:1e22 with SMTP id ffacd0b85a97d-3504a61c818mr1654079f8f.14.1715332763321; Fri, 10 May 2024 02:19:23 -0700 (PDT) X-Received: by 2002:a5d:6650:0:b0:34d:7f17:1e22 with SMTP id ffacd0b85a97d-3504a61c818mr1654058f8f.14.1715332762858; Fri, 10 May 2024 02:19:22 -0700 (PDT) Received: from ?IPV6:2003:cb:c710:2b00:9c9f:9357:3f4c:5358? (p200300cbc7102b009c9f93573f4c5358.dip0.t-ipconnect.de. [2003:cb:c710:2b00:9c9f:9357:3f4c:5358]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad074sm4067920f8f.70.2024.05.10.02.19.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 May 2024 02:19:22 -0700 (PDT) Message-ID: Date: Fri, 10 May 2024 11:19:21 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping functions To: Steven Rostedt , Vincent Donnefort Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, kernel-team@android.com, rdunlap@infradead.org, rppt@kernel.org, linux-mm@kvack.org References: <20240430111354.637356-1-vdonnefort@google.com> <20240430111354.637356-3-vdonnefort@google.com> <20240507223402.206d6ddc@rorschach.local.home> Content-Language: en-US From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpB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q 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240507223402.206d6ddc@rorschach.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08.05.24 04:34, Steven Rostedt wrote: > On Tue, 30 Apr 2024 12:13:51 +0100 > Vincent Donnefort wrote: > >> +#ifdef CONFIG_MMU >> +static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer, >> + struct vm_area_struct *vma) >> +{ >> + unsigned long nr_subbufs, nr_pages, vma_pages, pgoff = vma->vm_pgoff; >> + unsigned int subbuf_pages, subbuf_order; >> + struct page **pages; >> + int p = 0, s = 0; >> + int err; >> + >> + /* Refuse MP_PRIVATE or writable mappings */ >> + if (vma->vm_flags & VM_WRITE || vma->vm_flags & VM_EXEC || >> + !(vma->vm_flags & VM_MAYSHARE)) >> + return -EPERM; >> + >> + /* >> + * Make sure the mapping cannot become writable later. Also tell the VM >> + * to not touch these pages (VM_DONTCOPY | VM_DONTEXPAND). Finally, >> + * prevent migration, GUP and dump (VM_IO). >> + */ >> + vm_flags_mod(vma, VM_DONTCOPY | VM_DONTEXPAND | VM_IO, VM_MAYWRITE); > > Do we really need the VM_IO? > > When testing this in gdb, I would get: > > (gdb) p tmap->map->subbuf_size > Cannot access memory at address 0x7ffff7fc2008 > > It appears that you can't ptrace IO memory. When I removed that flag, > gdb has no problem reading that memory. > > I think we should drop that flag. > > Can you send a v23 with that removed, Shuah's update, and also the > change below: > >> + >> + lockdep_assert_held(&cpu_buffer->mapping_lock); >> + >> + subbuf_order = cpu_buffer->buffer->subbuf_order; >> + subbuf_pages = 1 << subbuf_order; >> + >> + nr_subbufs = cpu_buffer->nr_pages + 1; /* + reader-subbuf */ >> + nr_pages = ((nr_subbufs) << subbuf_order) - pgoff + 1; /* + meta-page */ >> + >> + vma_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; >> + if (!vma_pages || vma_pages > nr_pages) >> + return -EINVAL; >> + >> + nr_pages = vma_pages; >> + >> + pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL); >> + if (!pages) >> + return -ENOMEM; >> + >> + if (!pgoff) { >> + pages[p++] = virt_to_page(cpu_buffer->meta_page); >> + >> + /* >> + * TODO: Align sub-buffers on their size, once >> + * vm_insert_pages() supports the zero-page. >> + */ >> + } else { >> + /* Skip the meta-page */ >> + pgoff--; >> + >> + if (pgoff % subbuf_pages) { >> + err = -EINVAL; >> + goto out; >> + } >> + >> + s += pgoff / subbuf_pages; >> + } >> + >> + while (s < nr_subbufs && p < nr_pages) { >> + struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]); >> + int off = 0; >> + >> + for (; off < (1 << (subbuf_order)); off++, page++) { >> + if (p >= nr_pages) >> + break; >> + >> + pages[p++] = page; >> + } >> + s++; >> + } > > The above can be made to: > > while (p < nr_pages) { > struct page *page; > int off = 0; > > if (WARN_ON_ONCE(s >= nr_subbufs)) > break; I'm not particularly happy about us calling vm_insert_pages with NULL pointers stored in pages. Should we instead do if (WARN_ON_ONCE(s >= nr_subbufs)) { err = -EINVAL; goto out; } ? -- Cheers, David / dhildenb