Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp725951ybm; Wed, 22 May 2019 10:27:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwX0aCj0qKDV2kxrxtqC2uDxnNhqh4xhTDYLKVDw6EepzHUtp0gq+b8PnTpd89pUfeZgHge X-Received: by 2002:a62:ac01:: with SMTP id v1mr36159268pfe.110.1558546040396; Wed, 22 May 2019 10:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558546040; cv=none; d=google.com; s=arc-20160816; b=KUsYtlJYJth6o+DUnyy0djuE4XZZupNw4+vaYuSCwg2zpo5wAB99mim77sl1CD2Kbn cXU/rjnb7YprMGf+9duf7dXEMQnME8nfxyCGaNZNZb1xUMneVNgkWJ5oVSrGqgRlDnBs rZMKXFxX1VAuaivxdEfqqC+BNDQIioJwe/3h/cpMRsDeV3esRlJ6ZFYEuISC9Y3BpJ3F aP88pdFaaIgzm9NgfBoLjWXDdv+wIaueydcjHeJhKEedwZ/C5wslX6L1jTEE3mucN2lJ f7IuGfvrc6O4rxzc4IsrBRXKbtI+YTddqyi1mjL+jpNtfL9izjtCrV58WnPo7o2RU78F R0JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=jy/VKkUbnwci0tsuNXKWhu1p6E3wYsS5mFZ8f4sHtBE=; b=ATupfDSuRhwzj5LsTySexNVCdNore6+eT9tgTELqqODn4KQLJmWaSCVtWRbP7bifRr 7LMX5lv6LTxLnzd9bz+dmOTmdRNoI/gc7ZhcXu4l3k7cbYBX4E/bKiVXr897PkHZGweL dawEfmF6YdwpuuVk/UNI3Y6XrdRdmtwu4wseGVO3SSd3ZvrwsOtL5J5ABP3sak55sAj3 dyYDrvWg5p1/pDcsdymatRM+z3ZQznZeP76y8pS8my1OFlbjBf1ml+LAOI83du1AxsZI XI6Ff/PrAzqxHdmDcVm0BVx1QBkd1ed1yaPfKaL/tyuqsmgfdId8WyrbLxC1MN3nabPa skLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si27042308pgg.531.2019.05.22.10.27.04; Wed, 22 May 2019 10:27:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729864AbfEVRJD (ORCPT + 99 others); Wed, 22 May 2019 13:09:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47392 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729430AbfEVRJD (ORCPT ); Wed, 22 May 2019 13:09:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52168307D96D; Wed, 22 May 2019 17:08:58 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.khw1.lab.eng.bos.redhat.com [10.16.200.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id A21CB611A0; Wed, 22 May 2019 17:08:56 +0000 (UTC) Subject: Re: [PATCH] modules: fix livelock in add_unformed_module() To: Barret Rhoden , Jessica Yu Cc: linux-kernel@vger.kernel.org, Heiko Carstens , David Arcari References: <20190510184204.225451-1-brho@google.com> From: Prarit Bhargava Message-ID: Date: Wed, 22 May 2019 13:08:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 22 May 2019 17:09:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/19 10:37 AM, Barret Rhoden wrote: > Hi - > Hey Barret, my apologies for not getting back to you earlier. I got caught up in something that took me away from this issue. > On 5/13/19 7:23 AM, Prarit Bhargava wrote: > [snip] >> A module is loaded once for each cpu. > > Does one CPU succeed in loading the module, and the others fail with EEXIST? > >> My follow-up patch changes from wait_event_interruptible() to >> wait_event_interruptible_timeout() so the CPUs are no longer sleeping and can >> make progress on other tasks, which changes the return values from >> wait_event_interruptible(). >> >> https://marc.info/?l=linux-kernel&m=155724085927589&w=2 >> >> I believe this also takes your concern into account? > > That patch might work for me, but I think it papers over the bug where the check > on old->state that you make before sleeping (was COMING || UNFORMED, now !LIVE) > doesn't match the check to wake up in finished_loading(). > > The reason the issue might not show up in practice is that your patch basically > polls, so the condition checks in finished_loading() are only a quicker exit. > > If you squash my patch into yours, I think it will cover that case. Though if > polling is the right answer here, it also raises the question of whether or not > we even need finished_loading(). > The more I look at this I think you're right. Let me do some additional testing with your patch + my original patch. P. > Barret