From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933394AbdJQCEg (ORCPT ); Mon, 16 Oct 2017 22:04:36 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:53959 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060AbdJQCEb (ORCPT ); Mon, 16 Oct 2017 22:04:31 -0400 X-Google-Smtp-Source: ABhQp+TpN/JzVdraq1avHvQjJ0yAjbdNSqIoVLtJ3AbuepTd5fJTI7AqoqqNBX9baWPudix+zASVaA== Subject: Re: [PATCH v2 09/12] of: overlay: avoid race condition between applying multiple overlays To: Rob Herring , Pantelis Antoniou , David Airlie , Jyri Sarha References: <1508203074-26917-1-git-send-email-frowand.list@gmail.com> <1508203074-26917-10-git-send-email-frowand.list@gmail.com> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Tomi Valkeinen , dri-devel@lists.freedesktop.org From: Frank Rowand Message-ID: <59E5652C.3020206@gmail.com> Date: Mon, 16 Oct 2017 19:04:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1508203074-26917-10-git-send-email-frowand.list@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/17 18:17, frowand.list@gmail.com wrote: > From: Frank Rowand > > The process of applying an overlay consists of: > - unflatten an overlay FDT (flattened device tree) into an > EDT (expanded device tree) > - fixup the phandle values in the overlay EDT to fit in a > range above the phandle values in the live device tree > - create the overlay changeset to reflect the contents of > the overlay EDT > - apply the overlay changeset, to modify the live device tree, > potentially changing the maximum phandle value in the live > device tree > > There is currently no protection against two overlay applies > concurrently determining what range of phandle values are in use > in the live device tree, and subsequently changing that range. > Add a mutex to prevent multiple overlay applies from occurring > simultaneously. > > Move of_resolve_phandles() into of_overlay_apply() so that it does not > have to be duplicated by each caller of of_overlay_apply(). > > The test in of_resolve_phandles() that the overlay tree is detached is > temporarily disabled so that old style overlay unittests do not fail. > > Signed-off-by: Frank Rowand > --- Brown paper bag time. Changes from version 1: squash "[PATCH] of: overlay: move resolve phandles into of_overlay_apply()" into "[PATCH 09/12] of: overlay: avoid race condition between applying multiple overlays" > drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c | 6 ------ > drivers/of/of_private.h | 12 +++++++++++ > drivers/of/overlay.c | 32 ++++++++++++++++++++++++++++ > drivers/of/resolver.c | 7 ++++++ > drivers/of/unittest.c | 22 +++++++++++++------ > include/linux/of.h | 3 --- > 6 files changed, 67 insertions(+), 15 deletions(-) > < snip >