Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1644426pxf; Fri, 26 Mar 2021 11:26:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4rHUmhc+V8RQ8wKtWJXE4umpVT0KS7fW5azaMoPeZWyxWoNchkxuEfxgCe6wpUHLOg7mb X-Received: by 2002:a17:906:68c5:: with SMTP id y5mr17117599ejr.371.1616783163967; Fri, 26 Mar 2021 11:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616783163; cv=none; d=google.com; s=arc-20160816; b=zSg5BIM+BSvnRbNYI9wcUkwOqUsORbDQc0oXnrKqJ8Qmj24HslL/s60PwSrEn/0avo h60vDFLqJEfW7OEuERCxn991TTQOdUcv2+9kAzcbNbB/E7lt7RZs6POt14T6tV1fBci9 AFo5rG0CpeBKHKHnaBBaCmmJFvvbL1bqyzDFqwNch1af7JR0p6/U7KfLUC5gazcv/V1s bOL48LPIvj/3jTDbpp9jil+yuSVEVz7ihwouEwWUnXSM+slnJ//78qrd+FatlygOXOyH 8EdFJ+E67sAuE3JMzNOyPiHReCQ4ooZaCJdv1y7E3clIQN55qpvz171uE/2D1UlECNDP x2bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:organization:subject:from :to:reply-to:dkim-signature; bh=sqgoE7oUkWi10dRfiKf4O0yLFX/FHCjCOBZ7f/F44Jg=; b=F/QJTRKlQkBhP/X/bLrzP+B8N1rFvVg5RCP+HocV1/A+HB0y0+XYaH2Qg82CZcu3dW MON2BEVqW0AeN5TSQJ+WiG5X51fiVLl0xc7bGYH0dyxtBy2NCYzeTUQ0NPZpAW6xcYv4 WtyNWyTx4GADoFAU9MP8w2DLfV6RAPLeiZjLR0Uo22zWRMub1KxI7gL0TX+cyYludtZu Au0PvPolt0A804BWfUzxlX5P5FUuIZMj/HwztNXkBRwuuxuCJP0wa4S9DM5Bi8FIty1k v5EgtfjivqbseiM1N9Ib681w4+QJUCi08F+TvJ6zA7Otc5gDdShDCcqUZG9O4Xut6gFw PU5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="GnF/CX+d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si7360232eju.48.2021.03.26.11.25.41; Fri, 26 Mar 2021 11:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="GnF/CX+d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbhCZSYi (ORCPT + 99 others); Fri, 26 Mar 2021 14:24:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43400 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbhCZSYb (ORCPT ); Fri, 26 Mar 2021 14:24:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616783070; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sqgoE7oUkWi10dRfiKf4O0yLFX/FHCjCOBZ7f/F44Jg=; b=GnF/CX+duq4rPTvkvMHH2MqB8L5Et/Tu/5f1W5DismnmoN2tViw1NC+TaP3E9nyTwlB6lb c6/FLqJ2/o7H3mDQxy2H6OopYC4r9TWNvvjUq5jgpqLwgPKeXJPLDltCuP7Z/JeLYpEMEa 5ybRTYMsxHnCXXb02ATikhe9NPD7lU4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-9o3difxnMi2VTAOjuBaKEA-1; Fri, 26 Mar 2021 14:23:45 -0400 X-MC-Unique: 9o3difxnMi2VTAOjuBaKEA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5AFC58A2A15; Fri, 26 Mar 2021 18:23:40 +0000 (UTC) Received: from crecklin.bos.csb (ovpn-112-25.rdu2.redhat.com [10.10.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0500819C71; Fri, 26 Mar 2021 18:23:39 +0000 (UTC) Reply-To: crecklin@redhat.com To: "Matthew Wilcox (Oracle)" , LKML From: Chris von Recklinghausen Subject: tools/testing/radix-tree/idr-test gets a failed assertion on single cpu systems Organization: Red Hat Message-ID: Date: Fri, 26 Mar 2021 14:23:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Matthew, I made the observation that while tools/testing/radix-tree/idr-test runs and passes just fine on a system with more than one cpu, it gets an assertion failure when run on a single cpu system. My test system is Fedora 34 running on an x86_64 system. It can be easily reproduced by offlining all cpus but cpu0. [root@hpe-ml110g7-01 linux]# tools/testing/radix-tree/idr-test vvv Ignore these warnings assertion failed at idr.c:250 assertion failed at idr.c:206 ^^^ Warnings over idr-test: idr-test.c:320: idr_find_test_1: Assertion `!(entry != xa_mk_value(id))' failed. Aborted (core dumped) I bisected the change to 5c089fd0c734 ("idr: Fix idr_get_next race with idr_remove"). Since idr_get_next can return NULL, I stuck a BUG_ON(!entry) just above the failing assert, and in this case idr_get_next is returning NULL. Next, I stuck a BUG_ON in the place that idr_get_next_ul returns NULL and commented out the contents of idr_u32_test1 so we're not knowingly passing it bad values, and we seem to fail because the list has been gone through. void *idr_get_next_ul(struct idr *idr, unsigned long *nextid) {     struct radix_tree_iter iter;     void __rcu **slot;     void *entry = NULL;     unsigned long base = idr->idr_base;     unsigned long id = *nextid;     id = (id < base) ? 0 : id - base;     radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, id) {         entry = rcu_dereference_raw(*slot);         if (!entry)             continue;         if (!xa_is_internal(entry))             break;         if (slot != &idr->idr_rt.xa_head && !xa_is_retry(entry))             break;         slot = radix_tree_iter_retry(&iter);     }     if (!slot)         return NULL; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     *nextid = iter.index + base;     return entry; } EXPORT_SYMBOL(idr_get_next_ul); I'm not sure if this is a test issue or possibly an issue with user level RCU when there's only a single cpu in the system, but I figured it was worth bringing it to your attention. If there's anything I can do to help to further analyze this or try out a fix, I'm happy to help. Thanks, Chris von Recklinghausen Red Hat