From nobody Tue Dec 16 19:43:36 2025 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 2FC9D1ADC93 for ; Tue, 11 Mar 2025 13:18: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=1741699126; cv=none; b=iG6OOnaVpA18gE5EgWMQJnFRXjROwR+3oUWZ0dhH/m8NImFfF4NbrDx5zS559vTnsyfvmhfk5f5YDgvY7aKnaVPlJpQUN+GFO3ibw+VOE/DmrpuAP6ti2g3yRxwIIn9IE2RfGB15+SsXRPqGilUVj/UPnA1cJYRHntbQibILmdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741699126; c=relaxed/simple; bh=Bvrdg6/K54PEW5JZWuRIH9o+4LbgcalZobFw2iLsFJc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=BGym26RJzpmZAokH3KOEnm+5ljw5fkONCu3QyyrTkB98NbdDnVDYlRp6tKbGBJQiC5jSYVK7LfUY1JCfeFPKfpRw7iforKOAVuPc6wNqK1iRNHeRAuO7wfQ8Klr4kBwZJOar8MPPhDDqnbcNPliSTWaM/CU2WpzdZSRoE7HzG8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZLLQP4AQ; 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--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZLLQP4AQ" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-43935e09897so37961505e9.1 for ; Tue, 11 Mar 2025 06:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1741699122; x=1742303922; 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=YKUi+ss9u14qyT/Zwiy2mGBFpcrhT9F3tYQ4X8eVY2g=; b=ZLLQP4AQ/86m29e6rCRtWMtTeJ4eEWH/rlCpuDIVCXqMbKe8fNV+q1YlPeFtxuxIe+ lAr8koA09fyMkn8vlutvIDmUd/99XooEfmYR9a0regP8NemB1GH4ktvpygDyoIYuODsj AFl4V8pwzyMqeK4ZCKYmKEnypV9+1BEKgQTBL5ACML5k8SWU+6u5ExAQnh2n+S7R5R9j xyG7Jv1ypj29SGit1zzZFooCWJY6vRo69jZyCQjHui9JVoa6TQCaH5oKRb+dUCORjpTP xvjiCOnEHtljnCeJWwENRqkIP869oshjj3KTJQBrP+g4v5vM2Pf7ywFYKd9wuh//0Hq/ DobQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741699122; x=1742303922; 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=YKUi+ss9u14qyT/Zwiy2mGBFpcrhT9F3tYQ4X8eVY2g=; b=MmaMnhkX6yGwvlUGR0tF4CzBt4vEGKeXKQsZCnh5KfW7pQS/V0j5/koI/bWw/kSOcC b+v1x1WYepw1pOTzR4J75c6KRtAWXTmMbeAIt9h4OSIhga3x1u0ofl9pK1skQhMYJuU0 snTpzCR/LBIm0gLILl3YTtGqn5CWUIoHm/lDNdfNAdNnpq+ke1c/W/UQY9WL5Il5fDH8 6rWIbt104YcC8vfavqhHUNh8pqokXukVrmVeo5qw7xk3gZHJ4csLmKpFeOYkqBeDTAv+ NFRS9O5huFE05kWDPwgocIH73C+5DfawGZIIhcykMSyj2w75704XiVYqLw+IQ6F+QUtD bvfg== X-Forwarded-Encrypted: i=1; AJvYcCVRTgJIXlw928Xs/aVg6Jo190BepBKQP/G22sbTY5j/wESP0u03xfGryDi9EkonU7FRy3Y07uiM9KDWlCY=@vger.kernel.org X-Gm-Message-State: AOJu0YzbhhbyHkZhOBscVmZkLXdP4AJYw0Jge8gDbrMu0Ip6TpKEQWth mnLWP+b58uE5KWUcfZT8lrvXsbzETfgd/d52JARcmvRzb5jccEhK8IkTrwqZkV1FC+hRFYXzZ8N 3kV06l+uo0A== X-Google-Smtp-Source: AGHT+IFEGPTY7Ml+tuTOynefjzLO+UpkB6moVI+rzTawpqu6Ohcjxyu/ir2TjMNVGvCGq6alb9Lb1cZqdGxcFw== X-Received: from wmpz18.prod.google.com ([2002:a05:600c:a12:b0:43c:ebbe:4bce]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:6d9a:b0:43c:ef55:f1e8 with SMTP id 5b1f17b1804b1-43cef55f398mr97810345e9.13.1741699121899; Tue, 11 Mar 2025 06:18:41 -0700 (PDT) Date: Tue, 11 Mar 2025 13:18:23 +0000 In-Reply-To: <20250311-mm-selftests-v4-0-dec210a658f5@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250311-mm-selftests-v4-0-dec210a658f5@google.com> X-Mailer: b4 0.14.2 Message-ID: <20250311-mm-selftests-v4-12-dec210a658f5@google.com> Subject: [PATCH v4 12/12] selftests/mm/mlock: Print error on failure From: Brendan Jackman To: Lorenzo Stoakes , Andrew Morton , Shuah Khan Cc: Dev Jain , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Brendan Jackman Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable It's not really possible to start diagnosing this without knowing the actual error. Also update the mlock2 helper to behave like libc would by setting errno and returning -1. Signed-off-by: Brendan Jackman --- tools/testing/selftests/mm/mlock-random-test.c | 4 ++-- tools/testing/selftests/mm/mlock2.h | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/mm/mlock-random-test.c b/tools/testing= /selftests/mm/mlock-random-test.c index 1cd80b0f76c33f04ef01f4dee6602f28b6a7c991..b8d7e966f44c67e5606d384bd66= 0e5a4e5e8fda9 100644 --- a/tools/testing/selftests/mm/mlock-random-test.c +++ b/tools/testing/selftests/mm/mlock-random-test.c @@ -161,9 +161,9 @@ static void test_mlock_within_limit(char *p, int alloc_= size) MLOCK_ONFAULT); =20 if (ret) - ksft_exit_fail_msg("%s() failure at |%p(%d)| mlock:|%p(%d)|\n", + ksft_exit_fail_msg("%s() failure (%s) at |%p(%d)| mlock:|%p(%d)|\n", is_mlock ? "mlock" : "mlock2", - p, alloc_size, + strerror(errno), p, alloc_size, p + start_offset, lock_size); } =20 diff --git a/tools/testing/selftests/mm/mlock2.h b/tools/testing/selftests/= mm/mlock2.h index 4417eaa5cfb78ba2bb0f51d3418c9b768ff0fe90..81e77fa41901a095cc041e05d01= da7dffbf2f4fe 100644 --- a/tools/testing/selftests/mm/mlock2.h +++ b/tools/testing/selftests/mm/mlock2.h @@ -6,7 +6,13 @@ =20 static int mlock2_(void *start, size_t len, int flags) { - return syscall(__NR_mlock2, start, len, flags); + int ret =3D syscall(__NR_mlock2, start, len, flags); + + if (ret) { + errno =3D ret; + return -1; + } + return 0; } =20 static FILE *seek_to_smaps_entry(unsigned long addr) --=20 2.49.0.rc0.332.g42c0ae87b1-goog