Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp271726rwe; Fri, 26 Aug 2022 04:56:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR55J/bunyNdSzPKpmaY0VWdjLcl46aBJCn0aMe16RS0WnAC3lEqGPPDkujjsCF9Z6kfHv9J X-Received: by 2002:a17:90a:d149:b0:1fb:6dfb:1fb8 with SMTP id t9-20020a17090ad14900b001fb6dfb1fb8mr3949155pjw.25.1661514983919; Fri, 26 Aug 2022 04:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661514983; cv=none; d=google.com; s=arc-20160816; b=AePVuWR813vrgJM+XoQ/2mrji7tNjLl+2zFuVdgUE/OFKuKHzQzsvkrA55Xa2lFX5K pQOtz0yzqv+m3MzJGEGGv810FmrIHGOgttOFpwD2KHbGOXRhnTjGNVKMTC+0By3AdMvm wtBgvyk0Oe3snLYeJyLD8E9TVnQj62pN1UPO6oBcAQ5gWj4BW8Wfb1gkfF0V81rGaTKV QIJWcgk0Ohw+BG/4I0HSmnzxD8BuSkY4yCOJMz882XB6DPGlWL5PJjFcaZ+r+1fbNvFH KTnTIelBibb8xy0yQT3KcoWL7Qi/m39WGwl8Zu3Z69M04YnAmV75zyDG+O04jroEsXjK 31dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=mHGinpi7lqtAkMwygFoIPaEx54TEBffoywenxaeAscc=; b=dQ1HyTaFGmFYQ2C+RyRCjWsP9b5bWjsV5Z8pRlz6ygbwpxaikW7Ol5WjjzExCjxtCF TOMTqVPuPwBQtfub2H1Mo6BPpvkqDAjXxYGowpFjBV3F15aNpS2QQMZAXnww5qGAtiHg hbCvybHI3ncwXeZt90dt6lS3M6MihqTEJ8JMa698vpcUAncxhQXgwqkKFH9PSO59BiUu meeDNrvhjw7ccTA56RYP+ATIu8GgT2ROPjTcl4yguNlDoRioESRzs7smDeD+SiTkSdrb gODcGhWOTRCFWOPBNvDBQHzf4AORa28xXvofYsJEscXhqG4HJ945GWihSxetHqdpBerZ 2QSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rit1P5cn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a63f609000000b003fe3b8c6ff1si1639833pgh.154.2022.08.26.04.56.12; Fri, 26 Aug 2022 04:56:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rit1P5cn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230307AbiHZLqV (ORCPT + 99 others); Fri, 26 Aug 2022 07:46:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiHZLqU (ORCPT ); Fri, 26 Aug 2022 07:46:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A15F6B275F for ; Fri, 26 Aug 2022 04:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661514378; 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: in-reply-to:in-reply-to:references:references; bh=mHGinpi7lqtAkMwygFoIPaEx54TEBffoywenxaeAscc=; b=Rit1P5cnaIZNxSAM15tx41oPwrQkoX5usOlJI/IV+fuFJ/eDC2rizuxVvTurCkMUi+F9e4 vO5etDexIgXpyLoHlSZfbxAbODQCzi/fncwYr7Dje0LwLYded+XplUJpD+Wvnlm/JPWHZf kJxNgN2ay6QcXSI13Nzducn10PWg0Gk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-twmuZMTTO26HbL7tcjyqYA-1; Fri, 26 Aug 2022 07:46:15 -0400 X-MC-Unique: twmuZMTTO26HbL7tcjyqYA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5BC6804191; Fri, 26 Aug 2022 11:46:14 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AB6040B40C8; Fri, 26 Aug 2022 11:46:14 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 27QBkE6h018375; Fri, 26 Aug 2022 07:46:14 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 27QBkDlA018371; Fri, 26 Aug 2022 07:46:13 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 26 Aug 2022 07:46:13 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Will Deacon cc: Linus Torvalds , Alan Stern , Andrea Parri , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Joel Fernandes , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH] wait_on_bit: add an acquire memory barrier In-Reply-To: <20220826112327.GA19774@willie-the-truck> Message-ID: References: <20220826112327.GA19774@willie-the-truck> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Aug 2022, Will Deacon wrote: > On Thu, Aug 25, 2022 at 05:03:40PM -0400, Mikulas Patocka wrote: > > Here I reworked your patch, so that test_bit_acquire is defined just like > > test_bit. There's some code duplication (in > > include/asm-generic/bitops/generic-non-atomic.h and in > > arch/x86/include/asm/bitops.h), but that duplication exists in the > > test_bit function too. > > > > I tested it on x86-64 and arm64. On x86-64 it generates the "bt" > > instruction for variable-bit test and "shr; and $1" for constant bit test. > > On arm64 it generates the "ldar" instruction for both constant and > > variable bit test. > > > > For me, the kernel 6.0-rc2 doesn't boot in an arm64 virtual machine at all > > (with or without this patch), so I only compile-tested it on arm64. I have > > to bisect it. > > It's working fine for me and I haven't had any other reports that it's not > booting. Please could you share some more details about your setup so we > can try to reproduce the problem? I'm bisecting it now. I'll post the offending commit when I'm done. It gets stuck without printing anything at this point: Loading Linux 6.0.0-rc2 ... Loading initial ramdisk ... EFI stub: Booting Linux Kernel... EFI stub: Using DTB from configuration table EFI stub: Exiting boot services... I uploaded my .config here: https://people.redhat.com/~mpatocka/testcases/arm64-config/config-6.0.0-rc2 so you can try it on your own. The host system is MacchiatoBIN board with Debian 10.12. > This looks good to me, thanks for doing it! Just one thing that jumped out > at me: > > > Index: linux-2.6/include/linux/buffer_head.h > > =================================================================== > > --- linux-2.6.orig/include/linux/buffer_head.h > > +++ linux-2.6/include/linux/buffer_head.h > > @@ -156,7 +156,7 @@ static __always_inline int buffer_uptoda > > * make it consistent with folio_test_uptodate > > * pairs with smp_mb__before_atomic in set_buffer_uptodate > > */ > > - return (smp_load_acquire(&bh->b_state) & (1UL << BH_Uptodate)) != 0; > > + return test_bit_acquire(BH_Uptodate, &bh->b_state); > > Do you think it would be worth adding set_bit_release() and then relaxing > set_buffer_uptodate() to use that rather than the smp_mb__before_atomic()? > > Will Yes, we could add this (but it would be better to add it in a separate patch, so that backporting of the origianal patch to -stable is easier). Mikulas