From nobody Sat Nov 30 07:48:11 2024 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 36C9419924D for ; Tue, 10 Sep 2024 16:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725985425; cv=none; b=M676CSBnVEwvzbJC9MXWa1Cs8Z/RBubzg0pZAB6S9WjIhaysJsDW0jRjrrNSczzSkwK2LZceSrmdzz6GFiqU4//A2Wvk1jFDRnEtktpMCwVX6TpIo/mUwGaOvPmHPDRoL91v/6BpwXaMyuRx9XOEKVH7SbR6Gsa1IHOaZrOCYBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725985425; c=relaxed/simple; bh=GlHp+sDP2l3iuMBGJMRzuH4oTR65BYOzxJ6K7GQv29A=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=b5Blv3p/W45UOAD5nrU6QhiEA0RKwRDuN3ORWBPYRSfxMw8TZTy+8W7DMA6yJZEZV0KglqoieAwGOt0xT0E9Mr2wTDZZD9it+KXlRhEpILd4VoTMv+kVrNnVqyC0aESgo1nQvcORqolt2K9l87SBADbGhwtRpI01quRuT3gUs8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pmHDTV1L; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pmHDTV1L" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-42cb33e6299so19219205e9.2 for ; Tue, 10 Sep 2024 09:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725985421; x=1726590221; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ebNtXOw1zw+Y/P3jFG4DVeMhgHXmSDzSdOEI97BWEhQ=; b=pmHDTV1LBzxEn57OPtZ959cM9yCo6FtV14bdmSYOr0i8OOMznK96DIlafADdJD6h1w EvJ+sYMKEw+A2pXMXPwJ09hYcsNOv5YRYXEWFUHFuY/DLt1aw2465I52yWkklKzrCpq/ OVYh23XTnKW3gfyX2aIjagpvWG4GWghMjqp9oYPJ7xragDC1p5z8zmgnzjlKZ5+C+4f6 yq2bByUNbO9N/WbNpWrq1hoR752A8DS4WVPfJUqrijsrsq2VrHuesDze5GMRcX3GBPP4 Validza4xhvrA8IrwCJV1sUJZIgoGNH7XN2wG2F3s2V2ynDecMPZ0tmN4lCvxTM4lb6M 3u4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985421; x=1726590221; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ebNtXOw1zw+Y/P3jFG4DVeMhgHXmSDzSdOEI97BWEhQ=; b=wgAe1N/uMh8e7XdMfN1BzXMptibwRsUYPEqWfwrD3psPPKSnK61CLyWchI8r84vR8m 9l7iTMb/9FeQtbO07dJfqpEQ1txCpZWHkkQMUuyXteSOkmj05HH1clZcoVV6f/T+oMNU j4HJzcyT30D51ROAcjQpVixkDAY4wq2ElLi1CWWLidZzQY7Wd1BkMEAImTY2o49FZtL7 KcojH3eHcDkx2Lq9jfVXvTjjy0qImFaEKF4gsDIUFrS7ZS1vg2770uOR+RsDH5eO/tX8 cicpWfsDgR6kuLIhja1lU59BVFaK2lyEea4Ia/BWhm0XtJhtN8oZlaEwX+r2wFgtuqb7 vPbw== X-Forwarded-Encrypted: i=1; AJvYcCUTK+Sl+nF/OWLS/cXE7SKhxC7GR0W88Q2twRT+bhoIcurUjE4eXxzwluRa2uCiP61y5sM+P4zWyuC7A5s=@vger.kernel.org X-Gm-Message-State: AOJu0YxvypDoqxfUkTA07Y/sGtem4kTnAIC/F8Du8Osbgp0iknUSTD6z 6DaLqaWqRjhvQp5YKG4iJt4fldJu3EcclU0ic2OZLguR517loYCS3MfY6xGfDzfhmZT9scrBmae IhDgVVYs0U7Vx07BYsQ== X-Google-Smtp-Source: AGHT+IH1o/yd45zaUsI2O3gDVbqqWAfhLEcKZtzUdUtDk58M1Kz36FWtvb8nlXBaGxXyqHyWojvmUOgrKh/T56M4 X-Received: from vdonnefort.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2eea]) (user=vdonnefort job=sendgmr) by 2002:a05:600c:880e:b0:42c:b0ef:c70d with SMTP id 5b1f17b1804b1-42cb0efc875mr383485e9.1.1725985421494; Tue, 10 Sep 2024 09:23:41 -0700 (PDT) Date: Tue, 10 Sep 2024 17:23:34 +0100 In-Reply-To: <20240910162335.2993310-1-vdonnefort@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240910162335.2993310-1-vdonnefort@google.com> X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <20240910162335.2993310-2-vdonnefort@google.com> Subject: [PATCH RESEND 1/2] ring-buffer/selftest: Verify the entire meta-page padding From: Vincent Donnefort To: rostedt@goodmis.org Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kernel-team@android.com, Vincent Donnefort , Shuah Khan , linux-kselftest@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Improve the ring-buffer meta-page test coverage by checking for the entire padding region to be 0 instead of just looking at the first 4 bytes. Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Signed-off-by: Vincent Donnefort diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing= /selftests/ring-buffer/map_test.c index 4bb0192e43f3..ba12fd31de87 100644 Acked-by: Shuah Khan Acked-by: Steven Rostedt (Google) --- a/tools/testing/selftests/ring-buffer/map_test.c +++ b/tools/testing/selftests/ring-buffer/map_test.c @@ -231,15 +231,15 @@ TEST_F(map, data_mmap) =20 /* Verify meta-page padding */ if (desc->meta->meta_page_size > getpagesize()) { - void *addr; - data_len =3D desc->meta->meta_page_size; data =3D mmap(NULL, data_len, PROT_READ, MAP_SHARED, desc->cpu_fd, 0); ASSERT_NE(data, MAP_FAILED); =20 - addr =3D (void *)((unsigned long)data + getpagesize()); - ASSERT_EQ(*((int *)addr), 0); + for (int i =3D desc->meta->meta_struct_len; + i < desc->meta->meta_page_size; i +=3D sizeof(int)) + ASSERT_EQ(*(int *)(data + i), 0); + munmap(data, data_len); } } --=20 2.46.0.598.g6f2099f65c-goog From nobody Sat Nov 30 07:48:11 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 32F11A945 for ; Tue, 10 Sep 2024 16:23:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725985426; cv=none; b=GNZzGg8LqEqYIpTJJxZhJnCCwW9xWx9j3etFbyFoADU/86YRwCFJJAio7EYw4yJtSLSYwqSQxG6VUhzVzOzKwx87u2jcItYvJqloTgTBsVFQZnTX9IB5Ec88buS1Az86NbYn1E68b2/UhLURicbLi+X+rBLCG1AFlJzkebbjTIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725985426; c=relaxed/simple; bh=IDxzP8NIFFLJrT3njglStxjT1iS4xr2kKaPxUTaw2eI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GxY6YdK7JmlrXWRGPbDwzAzCRtQA5BXvVaAA5vVWLN6lrzdUEDPV3uKyIaPJOsklGEGDEFUS95yaMbQXTpLa00VX7CHfZst8pAN7O1nk1DAq9d56Uti28X264I4MrvCYCp02Q4fk48ZFINAia+7ajweSVdWxZVakJXOSGteWnuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xF04tJ0U; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xF04tJ0U" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6d7124938d1so191992407b3.0 for ; Tue, 10 Sep 2024 09:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1725985424; x=1726590224; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=k3gEWXD/IZ+HnaT6C3cDeHppcfA/fBRmYbhkS6oYyo8=; b=xF04tJ0U4KKfInAsQ2RTTKV19JHTtz/h/Ad93cLe89MZ3K6qUDQWFN2V4xAKPgblGp V5mv+JXD0dvp5CINnv+l9SZwq18cbj3CUY+rO6ob+x2M592R4hnj4TLFf4KUltqkuSmk 1tlXmhF6JRgHV7VjrLqpHQ2SvA2EjGDSwFY2VQmT2jRVc8HbJcQs2vWa2+oLkivX7+Et zKRzSVW7q6QqNpXLooUOW+9NPpWwYAspk5NXN50gzF9FE7+UoNVEKq7wYn4ZW0ol1Ryr JnhM3Ya9MxSqsIHnGqPcr7qN3HlTjZsmX+5gk2+UAiozgjClNCqJyaPfviMyXO/VLhdZ Vypg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725985424; x=1726590224; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k3gEWXD/IZ+HnaT6C3cDeHppcfA/fBRmYbhkS6oYyo8=; b=LQTCPmPIKpW6hLUMIrKtykn7ss5CN8f0bgsuqbKJXoYPGzS8vsY/u6wW52rmYEh+Wq aUAtsfzBC/3tlKPbS/BLS6LaOMMP1Qihe3yrLi/p2s1vmO/cM9KAeOrAED4AUunDNf53 9512X5/m80GCMA+zzynhHKbTbQVex09ipSgL7VuPo0T0490MMzl+qc30Zt7AJhKffuJc pn+JeBCwD9Q/LtH/hel9NNtWRdEEF+Qx8bWISHPY0Nic2s3LDqHpP0MsxW5ahyot+xr4 d/ao60T29vkHiuT1xsQBy4a71vXLjd0zFZFAcI2Dz5hDRY9GwjORpQ5fG7AlPXckf5R8 Zzxg== X-Forwarded-Encrypted: i=1; AJvYcCUwW8g/+iTZKuWMnQCo4tpu9EXUh2aFsBpCHhgdERukY6RnLTcbjZ7N5jqwtaEajlHVFcX3Gt8YzUA3ZmI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+NCmpu584XWiN+0SyWSSnUob3lkcWUeygSLEXcR33PimRDJow AAdBKD0W/oskDC9KY2JOzw8gM3XEGIcMwhzjWN3LJKCzgU9LHQ+2sWJuX9BaSCKfH88NHCctdX9 cTU/O9oWQ2pn/mflnrw== X-Google-Smtp-Source: AGHT+IFIKA+XvPoOxw+v8DGyTZTQiSOBgMRqezK95cE9yrJOsqwf2B357BaQ0JA4EDgrcvgiuQT7VwrhPTbXI7AW X-Received: from vdonnefort.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:2eea]) (user=vdonnefort job=sendgmr) by 2002:a05:690c:448a:b0:6db:34db:bc80 with SMTP id 00721157ae682-6db45163fc5mr3107447b3.5.1725985424256; Tue, 10 Sep 2024 09:23:44 -0700 (PDT) Date: Tue, 10 Sep 2024 17:23:35 +0100 In-Reply-To: <20240910162335.2993310-1-vdonnefort@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240910162335.2993310-1-vdonnefort@google.com> X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <20240910162335.2993310-3-vdonnefort@google.com> Subject: [PATCH RESEND 2/2] ring-buffer/selftest: Handle meta-page bigger than the system From: Vincent Donnefort To: rostedt@goodmis.org Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kernel-team@android.com, Vincent Donnefort , Shuah Khan , linux-kselftest@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Handle the case where the meta-page content is bigger than the system page-size. This prepares the ground for extending features covered by the meta-page. Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Signed-off-by: Vincent Donnefort diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing= /selftests/ring-buffer/map_test.c index ba12fd31de87..d10a847130fb 100644 Acked-by: Shuah Khan Acked-by: Steven Rostedt (Google) --- a/tools/testing/selftests/ring-buffer/map_test.c +++ b/tools/testing/selftests/ring-buffer/map_test.c @@ -92,12 +92,22 @@ int tracefs_cpu_map(struct tracefs_cpu_map_desc *desc, = int cpu) if (desc->cpu_fd < 0) return -ENODEV; =20 +again: map =3D mmap(NULL, page_size, PROT_READ, MAP_SHARED, desc->cpu_fd, 0); if (map =3D=3D MAP_FAILED) return -errno; =20 desc->meta =3D (struct trace_buffer_meta *)map; =20 + /* the meta-page is bigger than the original mapping */ + if (page_size < desc->meta->meta_struct_len) { + int meta_page_size =3D desc->meta->meta_page_size; + + munmap(desc->meta, page_size); + page_size =3D meta_page_size; + goto again; + } + return 0; } =20 --=20 2.46.0.598.g6f2099f65c-goog