Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5428428yba; Mon, 13 May 2019 10:38:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPsGQZiya1m6D9vrl8ciLUtlTvx7hx8CzzK5WYhUBIHl+elZOhL06itz5qGh5Rjj4APdBQ X-Received: by 2002:aa7:93bb:: with SMTP id x27mr34520153pff.104.1557769120754; Mon, 13 May 2019 10:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557769120; cv=none; d=google.com; s=arc-20160816; b=ZN6venpsNq2WV9jq6osqgmaW+47k4s7HPJ0uwi+CxTgcK7KEZMvU5Azd4nDVy4boFx YY5Q7+g9tKALUqF5aZKqt8ogJMIKPqMZhBRjEpNMYW0PW2HwpwqqZDXMphbReIMd14V0 3OH7wCP7LDvjhJViHWes1sh3H4Awco1rMIU8kSNXRgtzIL8n3RvVBfuwb4l18pi4HnwO YGuxbsQvOhMIt8aX/orTIETVE1Cwt/fBnh6kdsX9bgNuB+o0o13KMwlZGjDdZwMvmFZG ZpGCP3bn5Na7uygq2i3NcboHzndJ6OjMSdYKZIg6TWK56XNI6BMEBo3MskHrb4M8wAYg u7Ww== 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:dkim-signature; bh=b1o0hZ+fNp+TqSBs/mDlxw3u/lJ6G1FX/UwWcy48/68=; b=Py16TjlgWilKXPFWyftvJMF6Hj5HBioopRKfwO82/OBlXQlF2m0qWpCfW3D9aop2Ry Rqnc5gEhWWnCuZPhHF3spGAH/fhJo0HBNyi0BeDkuSLZyNvsjUfHSb45o6JPqiQ0W5is VKso9RYb43GzeHJV1dRw4vxqVTBzNxYLrstMUPMHTzdkhxyVH+g9cMZfqgMoHJXa4JWU nL89b2di3woRlOinWRHof2JRpwqxFwNmvXMaaVJLkKFr39y7hS5+INQ7tUMg9IOM2miz RfOL//OwM8Asd4zvg0GHSC2U2c9DwqWTyU9Uwt187NIL6jIpfw3e40siy4b9mnNel6uJ OHhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YjUaS2Vb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si12159556plb.69.2019.05.13.10.38.23; Mon, 13 May 2019 10:38:40 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=YjUaS2Vb; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729881AbfEMOhH (ORCPT + 99 others); Mon, 13 May 2019 10:37:07 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42664 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbfEMOhH (ORCPT ); Mon, 13 May 2019 10:37:07 -0400 Received: by mail-qk1-f195.google.com with SMTP id d4so8112719qkc.9 for ; Mon, 13 May 2019 07:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=b1o0hZ+fNp+TqSBs/mDlxw3u/lJ6G1FX/UwWcy48/68=; b=YjUaS2Vb2WjWhY+KnQogQB5+20ki2azppHbUzmpJZgic/3KY9g06lXHz/BvM0kJtIL 1Zdg2dmUz7E4EhistgPWt5OUJTej4S6Xg5fZ2jQBxudAW7UvAMbp3MjwuBPyMjFgPWbv yMnHoYQRXE/zylYEN9NTvpsnIwMT3ghIzpH4I7g2K/19wSBHUKs/ACry1VDbSEeMFrvc 298vpkrK2ITPmEM+JqHZyT0++tux8Rwu/EVd72Utiqn1Mp/m6XjF3rq0pbh1ypQgVqzM tsj0PHZsUx0Nwk8CjrHLpUrl4QnmTSoknvy7qmq/rcvfH+aYC0nOXd+Pr6U9eZYOroU5 /IKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=b1o0hZ+fNp+TqSBs/mDlxw3u/lJ6G1FX/UwWcy48/68=; b=YrNrjRU5TKzA+KvupjvdlIn2ByDtEQAucyVeuj1W41X2izBaey1+hUFqajWUcsFHGq TFHPCoHyHBd/Esk2fnTBrPB1YK1ElhK7EMw0yfGplab1p88oiTrps/u4Fwj+xTRpEhco HLkEAXO9/HqNE84FyAxxP6VnpAuIA5qM320az/Iox99wi7kBTaYso94/BSywoFG4klWG hk3pmeTAbdRdI12+K3iUcsf4QM4kC1DhIdfDr53g5aYBlGcOjTTGqeykucJ7ZC5F0FM9 sDjlLIZ7fm7lQJZIm9YvvC5E3JRTBTKbbZd93XqufgoAO4qsPpBFsf6uhd5cfWVQf6L7 al7A== X-Gm-Message-State: APjAAAX8hwjGAMaEm9fuUxTFcdcI4jIwvdW/DQ38wdWDXWyw54OPtss0 5+/uSHRWGe8MJhi1u19qvOSq/g== X-Received: by 2002:a05:620a:3:: with SMTP id j3mr5695470qki.95.1557758225466; Mon, 13 May 2019 07:37:05 -0700 (PDT) Received: from [192.168.1.10] (c-66-30-119-151.hsd1.ma.comcast.net. [66.30.119.151]) by smtp.gmail.com with ESMTPSA id y13sm11310485qtc.21.2019.05.13.07.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 07:37:04 -0700 (PDT) Subject: Re: [PATCH] modules: fix livelock in add_unformed_module() To: Prarit Bhargava , Jessica Yu Cc: linux-kernel@vger.kernel.org, Heiko Carstens , David Arcari References: <20190510184204.225451-1-brho@google.com> From: Barret Rhoden Message-ID: Date: Mon, 13 May 2019 10:37:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi - 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(). Barret