From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A69C433DB for ; Fri, 19 Mar 2021 19:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 646276197A for ; Fri, 19 Mar 2021 19:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbhCSTVy (ORCPT ); Fri, 19 Mar 2021 15:21:54 -0400 Received: from mga05.intel.com ([192.55.52.43]:48791 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbhCSTVo (ORCPT ); Fri, 19 Mar 2021 15:21:44 -0400 IronPort-SDR: 8siicJTJWmYz0sZc0YoRwrSt1Ves8tcwGQ8eMEt3VBngH1wDSdxG/9EWcRfUDEAzJ9IlfSGVjw eOYhyYytO01A== X-IronPort-AV: E=McAfee;i="6000,8403,9928"; a="275026165" X-IronPort-AV: E=Sophos;i="5.81,262,1610438400"; d="scan'208";a="275026165" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2021 12:21:43 -0700 IronPort-SDR: /H4gCoF9g4se1QXJKVk1w3PvsghJ+PAUkfXJrzUCugl6jswHeGnScAecBSiyTxY+rE9UyJUI2/ 97NzvL2o62Iw== X-IronPort-AV: E=Sophos;i="5.81,262,1610438400"; d="scan'208";a="450977622" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2021 12:21:41 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lNKgk-00DxCT-Ei; Fri, 19 Mar 2021 21:21:38 +0200 Date: Fri, 19 Mar 2021 21:21:38 +0200 From: Andy Shevchenko To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List , "open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" , "Rafael J. Wysocki" , Len Brown , Robert Moore , Erik Kaneda Subject: Re: [PATCH v2 1/1] ACPI: scan: Use unique number for instance_no Message-ID: References: <20210319183234.23629-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Mar 19, 2021 at 07:51:00PM +0100, Rafael J. Wysocki wrote: > On Fri, Mar 19, 2021 at 7:33 PM Andy Shevchenko > wrote: > > > > Current mechanism of incrementing and decrementing plain integer > > to get a next free instance_no when creating an ACPI device is buggy. > > > > The simple integer and operations line increment and decrement > > on top of it can't cover the possible gaps during run time. The > > arbitrary instantiation and elimination of the devices is racy > > But it isn't racy AFAICS. It always happens under acpi_device_lock(). Hmm.. indeed. I sent a v3 with the commit message based on your proposal. > > and after a couple of iterations with unequal amount of devices > > being added and removed we may reproduce a bug: -- With Best Regards, Andy Shevchenko