Received: by 10.213.65.68 with SMTP id h4csp1161919imn; Sat, 7 Apr 2018 19:51:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Pl0OUzRylCxn20Zw68FgUQP32poPjuEXbodUjYh9DSYbNm2A/K84kq7EAxIIA6dAPPcf7 X-Received: by 10.101.66.76 with SMTP id d12mr17187580pgq.109.1523155864260; Sat, 07 Apr 2018 19:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523155864; cv=none; d=google.com; s=arc-20160816; b=nqfcBDPlbYGpwQuB+S64ukSMn7gNrYKRJG5KDMcgbfESHBt25qm9kSp9tHVVlHpNdr K9mjCYWfPKzUJD52Ax2+r7k6z1KmQBRdOAhbSPtckeqOE2vALAwuZ2JXRf70q2DCwq4D fINjJEWh9gzAj0TkWeGXeIxGZZ45FNEC85C/g3pFB/nNN40on4POaXngdRNMpy0Z4uk3 LFbGAhJ64T49MOwNrHA0ZPzX2QgLpynRItnB1tgm5NRtsL9gzqRKF8AWhZvqsTHdJXb9 /zEiGBj0g4LbEYLxed9jzahNw4djEN6/1knlX0FHxv2R4cSjdQXkslGH2gCO2Xp+mQ9m 5xhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3ViJVYw2j2GjGVXBuJNO9i9zW/Wn16FXXHfhUAE64To=; b=q73bNjKoNtUgGFAjfQW4LfPvOBHDBsOScVPfATtK9dI30KPyLOJLLW0AH3/Qk6AZf8 7MEXhtSabbRHHemENHyLipnDoOiJwqF+2NvFSCJ7ab3XgauRA16VN/ye0kJZ9QXScYYX nAIblptt7O9KA5B9j7usOv8iJ2i1ls/OlR4oQNfy0YTF6Qv8gKO6Xo3YC3x+IFFlycmm GtyI0RIYbwDtN9foOTUTdXaEqWacZxfn96h3OBu+1JQeAitJVwl0Z7HMu6iELbdf4xtB KTphTu8pGj8548fnGJ5XaKEFZ4BqLHNjqQj2X+Gh5Yftysrq1d9niWGZ5jFth4YwCIIp YkjQ== 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 z11si9409300pgz.412.2018.04.07.19.50.27; Sat, 07 Apr 2018 19:51:04 -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 S1752603AbeDHCrb (ORCPT + 99 others); Sat, 7 Apr 2018 22:47:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41792 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752257AbeDHCra (ORCPT ); Sat, 7 Apr 2018 22:47:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86862722C3 for ; Sun, 8 Apr 2018 02:47:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-8-18.pek2.redhat.com [10.72.8.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id E67761102E23; Sun, 8 Apr 2018 02:47:28 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Baoquan He Subject: [PATCH v2 0/3] resource: Use list_head to link sibling resource Date: Sun, 8 Apr 2018 10:47:21 +0800 Message-Id: <20180408024724.16812-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sun, 08 Apr 2018 02:47:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sun, 08 Apr 2018 02:47:30 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This post mainly converts strut resource's sibling list from singly linked list to doubly linked list, list_head. This is suggested by Andrew. Since I need a reversed searching on iomem_resource's IORESOURCE_SYSTEM_RAM children, the old singly linked list way makes the code in v1 post really ugly. With this change, we only need one simple list_for_each_entry_reverse() to do reversed iteration on sibling list. The relevant codes in kernel/resource.c are more readable since those dazzling pointer operation codes for singly linked list are replaced. With the help of list_head, in patch 0002 we can have a very simple walk_system_ram_res_rev(). And in patch 0003, will use it to search available system RAM region for kexec_buffer of kexec_file from top to down, just like we have been doing all along in kexec loading which is done in kexec-tools utility. Note: This patchset passed testing on my kvm guest, x86_64 arch with network enabling. The thing we need pay attetion to is that a root resource's child member need be initialized specifically with LIST_HEAD_INIT() if sttically defined or INIT_LIST_HEAD() for dynamically definition. Here Just like we do for iomem_resource/ioport_resource, or the change in get_pci_domain_busn_res(). And there are two places of change I am not very sure. One is in drivers/hv/vmbus_drv.c, the other is in drivers/pci/host/vmd.c. So will invite experts on these areas to help review. v1->v2: Use list_head instead to link resource siblings. This is suggested by Andrew. Rewrite walk_system_ram_res_rev() after list_head is taken to link resouce siblings. Baoquan He (3): resource: Use list_head to link sibling resource resource: add walk_system_ram_res_rev() kexec_file: Load kernel at top of system RAM if required drivers/gpu/drm/gma500/gtt.c | 5 +- drivers/hv/vmbus_drv.c | 52 +++---- drivers/input/joystick/iforce/iforce-main.c | 4 +- drivers/nvdimm/e820.c | 2 +- drivers/nvdimm/namespace_devs.c | 14 +- drivers/nvdimm/nd.h | 5 +- drivers/of/address.c | 4 +- drivers/pci/host/vmd.c | 8 +- drivers/pci/probe.c | 2 + drivers/pci/setup-bus.c | 2 +- include/linux/ioport.h | 7 +- kernel/kexec_file.c | 2 + kernel/resource.c | 233 +++++++++++++++++----------- 13 files changed, 196 insertions(+), 144 deletions(-) -- 2.13.6