From patchwork Thu May 9 10:28:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 1933398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=avNcq2Tx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VZpBS3qXLz20fc for ; Thu, 9 May 2024 20:28:16 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id EB8293CE115 for ; Thu, 9 May 2024 12:28:13 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 671D13CE0C8 for ; Thu, 9 May 2024 12:28:11 +0200 (CEST) Authentication-Results: in-6.smtp.seeweb.it; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=liwang@redhat.com; receiver=lists.linux.it) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 in-6.smtp.seeweb.it (Postfix) with ESMTPS id 840C21400F8A for ; Thu, 9 May 2024 12:28:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715250489; 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; bh=/Pn7E6V/yofAI+ouecmjurolmSRAv+V7SyYRNcVkW1g=; b=avNcq2TxKQVLpSt8ZoKK86VB7K1IfqVbkLnykgNn98x2EPXZcR+srNqQ2CtwnuAG1LOwH/ 3OHm/ex5N72lxq/0Pa4lklJiH/mX6qBhOqeKUfd0BrXdmMr5RBHbWgXxa58Wi8gfURuxOy QO9xBvT3PwpPGdYGrTjgP66R4reDmzQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-QL7Yjc6PPt2IokfMHNYYSA-1; Thu, 09 May 2024 06:28:07 -0400 X-MC-Unique: QL7Yjc6PPt2IokfMHNYYSA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3CDC7857A81 for ; Thu, 9 May 2024 10:28:07 +0000 (UTC) Received: from dell-per7425-02.rhts.eng.pek2.redhat.com (dell-per7425-02.rhts.eng.pek2.redhat.com [10.73.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06DD07414; Thu, 9 May 2024 10:28:05 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Thu, 9 May 2024 18:28:02 +0800 Message-ID: <20240509102802.20091-1-liwang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-6.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH] madvise11: ignore EBUSY for MADV_SOFT_OFFLINE X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Luis Goncalves Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The EBUSY error could be easily triggered on small system with kernel-debug. By not treating EBUSY as a failure, the test can avoid false positives where the test environment itself might frequently cause resource contention. Test output: madvise11.c:409: TINFO: Spawning 4 threads, with a total of 640 memory pages madvise11.c:163: TINFO: Thread [0] returned 0, succeeded. madvise11.c:163: TINFO: Thread [2] returned 0, succeeded. madvise11.c:163: TINFO: Thread [1] returned 0, succeeded. madvise11.c:163: TINFO: Thread [3] returned 0, succeeded. madvise11.c:198: TPASS: soft-offline / mmap race still clean <--- end of 1st test madvise11.c:132: TFAIL: madvise failed: EBUSY (16) <--- ERROR! ... From kernel log: [ 431.590511] soft offline: 0xbfa8f: page migration failed 1, type 0x800000008002e(referenced|uptodate|dirty|active|swapbacked|node=0|zone=1) ... [ 435.510819] soft offline: 0x98fb6: page migration failed 1, type 0x800000008000e(referenced|uptodate|dirty|swapbacked|node=0|zone=1) ... Kernel callpath: do_madvise() --- #ifdef CONFIG_MEMORY_FAILURE if (behavior == MADV_HWPOISON || behavior == MADV_SOFT_OFFLINE) return madvise_inject_error(behavior, start, start + len_in); #endif --- madvise_inject_error() soft_offline_page() soft_offline_in_use_page() ... 2727 pr_info("soft offline: %#lx: %s migration failed %ld, type %pGp\n", 2728 pfn, msg_page[huge], ret, &page->flags); 2729 if (ret > 0) 2730 ret = -EBUSY; <--- Here Debugged-by: Luis Goncalves Signed-off-by: Li Wang Reviewed-by: Petr Vorel --- testcases/kernel/syscalls/madvise/madvise11.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testcases/kernel/syscalls/madvise/madvise11.c b/testcases/kernel/syscalls/madvise/madvise11.c index 7a12abf20..fe27a18d8 100644 --- a/testcases/kernel/syscalls/madvise/madvise11.c +++ b/testcases/kernel/syscalls/madvise/madvise11.c @@ -128,6 +128,8 @@ static int allocate_offline(int tnum) return -1; if (madvise(ptrs[num_alloc], pagesize, MADV_SOFT_OFFLINE) == -1) { + if (errno == EBUSY) + continue; if (errno != EINVAL) tst_res(TFAIL | TERRNO, "madvise failed"); if (errno == EINVAL)