Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3375629imm; Sun, 14 Oct 2018 18:52:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV63fMXSS66Cn5cKoZhJ8k+LAth/5Z5zmiJhYlow4msLjSQPDqQbcT3sUrybEgyUT8gZtom20 X-Received: by 2002:a63:1624:: with SMTP id w36-v6mr13933072pgl.409.1539568379940; Sun, 14 Oct 2018 18:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539568379; cv=none; d=google.com; s=arc-20160816; b=xsO5TLbPveYMIekUU8oIdQNgU67op4Dth4dn94bEMbqo0HOQTIz15pAz3dIo/5heIH TlfafX5T1RmD0f0UQbZ7EgWpMX2jxHabaxCFWC6yMuwnd4FbdlWB9gLfqwb/ZqZE1RLw bxK5W5vWdK6K9Enx/pzAv0oCeSYZeIw3CZzz4tBNC0CGkIHANgqBfM2vqPEPR/q+xx4A zEY00n9RbNUwUMBL3lLuOkgXhBaaDJORG1JzUE0TWrflYBPwS+VddwQ9qrQir95GZy38 KHdlg8GghLO22MtBGSeeYgFpC95R2NZVqaERK77mCTyPy56PHCVC8VpPLQKTt2hhowi9 tHUA== 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=bUrhhPAQHKxvChH2N6KNc44klfA4B1coEO58r1NxXE8=; b=Xc5gCVNNTCDgfURbzCF6gD01WrOrZLms2oqPzmEOZ/OKw0VXamglHdCmnKd5Wc5ypw yUrv0ciU6HHakDSLbJF4p2dsSgz5zksBRVp1SEsQdL3vAcWU8wHL7jri6cbmvkHUc0+0 QqQba7e6xG+IomNsYD9PmvXlv6Ivp3GTOB1PvhtIcMIXGzQhBDs2PUkLM6uALTYCzDvH 6/SmD6kWw/FC7zA112jjozNcuC9VQ/eCu5xsXnnPA7IQCKBwctnS2Gk0/xrqQ0ROnKVg zTYAtAnHpHucKjXpn0LupeXlZUnAGRZLfQLsZQ1AAb4lTwr6HkwY5RpY+eHix8Gy8bVd hW1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KJuVbdVK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si8727931plk.360.2018.10.14.18.52.44; Sun, 14 Oct 2018 18:52:59 -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=@gmail.com header.s=20161025 header.b=KJuVbdVK; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbeJOJf0 (ORCPT + 99 others); Mon, 15 Oct 2018 05:35:26 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45606 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbeJOJfZ (ORCPT ); Mon, 15 Oct 2018 05:35:25 -0400 Received: by mail-pl1-f195.google.com with SMTP id y15-v6so8467885plr.12; Sun, 14 Oct 2018 18:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=bUrhhPAQHKxvChH2N6KNc44klfA4B1coEO58r1NxXE8=; b=KJuVbdVK59gIqkR+1tLrHTmyIjBCyO6hyFkm+9xlQMjI9F235y5rSk+C0OFxH/h9V2 dyckwEKKJjKPRbnMh8Nb9GhZpIUTUDFeRRrptQps+N1cqDqohCOhgrtQVMkhbl6oojx1 1WgIZ6aDdakr+1/rZnyuBedSVJ2sUmalRZ35RhDEi1VADN1Ka8feDy6oFwBel3KZzIh5 uK78KeVvRtGAsdVTW2aZXuJwwDdYZ9aTEr94mJBxxzc+ARIBMJ406hMlcksmFOfHImXy lcr1wZKPmLsZrL1a4wcXz5y7wgoZpt+JgyvMZEDDm0e7AEX7mOidN65qZ79rSYDLif6+ 8jlA== 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=bUrhhPAQHKxvChH2N6KNc44klfA4B1coEO58r1NxXE8=; b=d6ICMINgoLxviEXpBkDRYNtGE19YQ16R6pgF//OvwWrggciHD0ARCsmH7aE3TxATic 4NEBo2SwGXmYp4rtHTIsyDYIOug4qu49QrKf8wrxY2lfpn2MC47AXtWIK2gBq/zdKwna iIkH9QxzbYGMdLt94xyCBjf+jkf8h8wgMSYTS88Dd4jf3S8pCqmPrL/jcoREraNK9+lV 9JILLiXDpa7/ZLgT0IuzL1oKyEp78Ubug9F8wnUaoSvCtx6T0C+BbCxOTk+rv0NpAEE2 nBH9mDfwp10wO5H9D13YapJcTSurtz8kSNqvhciKZw/kjmzv7AL1dZs9OYzu7iPPuUk8 bU3g== X-Gm-Message-State: ABuFfoifMBXSZMINRWn+dd8tKeWJNcQgSZmP3d8xvk+XqsyiyiIUGQ2W 76g7fYAAj+zLWngHIVvpP6YYgBXy X-Received: by 2002:a17:902:9f97:: with SMTP id g23-v6mr14907990plq.68.1539568343349; Sun, 14 Oct 2018 18:52:23 -0700 (PDT) Received: from [192.168.1.70] (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id k72-v6sm15734479pfj.63.2018.10.14.18.52.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Oct 2018 18:52:22 -0700 (PDT) Subject: Re: [PATCH v3 13/18] of: overlay: check prevents multiple fragments touching same property To: Joe Perches , Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org References: <1539563070-12969-1-git-send-email-frowand.list@gmail.com> <1539563070-12969-14-git-send-email-frowand.list@gmail.com> From: Frank Rowand Message-ID: <850f0866-1189-5a49-01c5-79caf270abbd@gmail.com> Date: Sun, 14 Oct 2018 18:52:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 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 On 10/14/18 18:06, Joe Perches wrote: > On Sun, 2018-10-14 at 17:24 -0700, frowand.list@gmail.com wrote: >> From: Frank Rowand >> >> Add test case of two fragments updating the same property. After >> adding the test case, the system hangs at end of boot, after >> after slub stack dumps from kfree() in crypto modprobe code. > [] >> -static int check_changeset_dup_add_node(struct overlay_changeset *ovcs) >> +static int changeset_dup_entry_check(struct overlay_changeset *ovcs) >> { >> - struct of_changeset_entry *ce_1, *ce_2; >> - char *fn_1, *fn_2; >> - int name_match; >> + struct of_changeset_entry *ce_1; >> + int dup_entry = 0; >> >> list_for_each_entry(ce_1, &ovcs->cset.entries, node) { >> - >> - if (ce_1->action == OF_RECONFIG_ATTACH_NODE || >> - ce_1->action == OF_RECONFIG_DETACH_NODE) { >> - >> - ce_2 = ce_1; >> - list_for_each_entry_continue(ce_2, &ovcs->cset.entries, node) { >> - if (ce_2->action == OF_RECONFIG_ATTACH_NODE || >> - ce_2->action == OF_RECONFIG_DETACH_NODE) { >> - /* inexpensive name compare */ >> - if (!of_node_cmp(ce_1->np->full_name, >> - ce_2->np->full_name)) { >> - /* expensive full path name compare */ >> - fn_1 = kasprintf(GFP_KERNEL, "%pOF", ce_1->np); >> - fn_2 = kasprintf(GFP_KERNEL, "%pOF", ce_2->np); >> - name_match = !strcmp(fn_1, fn_2); >> - kfree(fn_1); >> - kfree(fn_2); >> - if (name_match) { >> - pr_err("ERROR: multiple overlay fragments add and/or delete node %pOF\n", >> - ce_1->np); >> - return -EINVAL; >> - } >> - } >> - } >> - } >> - } >> + dup_entry |= find_dup_cset_node_entry(ovcs, ce_1); >> + dup_entry |= find_dup_cset_prop(ovcs, ce_1); > > I think this is worse performance than before. > > This now walks all entries when before it would > return -EINVAL directly when it found a match. Yes, it is worse performance, but that is OK. This is a check that is done when a devicetree overlay is applied. If an error occurs then that means that the overlay was incorrectly specified. The file drivers/of/unittest-data/overlay_bad_add_dup_prop.dts in this patch provides an example of how a bad overlay can be created. Once an error was detected, the check could return immediately, or it could continue to give a complete list of detected errors. I chose to give the complete list of detected errors. -Frank