Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbdHQSzf (ORCPT ); Thu, 17 Aug 2017 14:55:35 -0400 Received: from mail-bn3nam01on0058.outbound.protection.outlook.com ([104.47.33.58]:17460 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752270AbdHQSzc (ORCPT ); Thu, 17 Aug 2017 14:55:32 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC Part1 PATCH v3 09/17] resource: Consolidate resource walking code To: Borislav Petkov , Brijesh Singh Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linux-efi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Tony Luck , Piotr Luc , Fenghua Yu , Lu Baolu , Reza Arbab , David Howells , Matt Fleming , "Kirill A . Shutemov" , Laura Abbott , Ard Biesheuvel , Andrew Morton , Eric Biederman , Benjamin Herrenschmidt , Paul Mackerras , Konrad Rzeszutek Wilk , Jonathan Corbet , Dave Airlie , Kees Cook , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Arnd Bergmann , Tejun Heo , Christoph Lameter References: <20170724190757.11278-1-brijesh.singh@amd.com> <20170724190757.11278-10-brijesh.singh@amd.com> <20170728152342.GB11564@nazgul.tnic> From: Tom Lendacky Message-ID: Date: Thu, 17 Aug 2017 13:55:18 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170728152342.GB11564@nazgul.tnic> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: MWHPR12CA0037.namprd12.prod.outlook.com (10.172.49.23) To CY4PR12MB1142.namprd12.prod.outlook.com (10.168.163.150) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65a95421-111c-4d35-e02e-08d4e5a1862e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY4PR12MB1142; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;3:SaIvytL0mereXC6rk7cm4z9urk5zEnovoST3WnnZ1wJ6dF+xXms/D61HXYBFdexnbUU+it3+GKx1nPMh5tkH6fWTbKZIg10cV2S2NM2/5G1rqJo5N53CgN7DFmMU8a2jrorYp9cqe+wGAEGIovX010d7FiSyuYuMJy7RfM/xDXub/KtvRZlLk9J/nMX/js5B9T+/4LiRZKPSAjHEaNMqsv0KOz0b73fwehxOvI9wZieE0V4Eex5Fie+bInOHMGQt;25:ZvySzZsN5D1zPs0avY59uwSOwxjfr3AhKfCiwu0jBcL/WGNyDmWsEkPsvLqJh0REkEKRlSo6d9wg6jwQ4rBqEoZrbkRXPScW8X+n/OpkA0eAep6ZHapiQA5iWChSdL82wrxDE0OBoGCyIjtJItWp9SyTtq38kThVvo5jrdeeAgHj64daqWvponwNFF6BD4vORjU+AZkOwOYxl9VMf6JE4tTw34dEvOHg6vVF1ElCF6ARAdeXecMBv3yd+WVzvEAaj1YNfBMHdakVoRwe5MFwALLo+6d2od/e/K0EnNrT0nDMbQ5lYoVIQ9BS2D4i5ywP+jUZ8ilIlmfCS1rCi3LU2A==;31:8qZUToTXoSCmD3rk/W8a7ICAM1S5F5S+9CxnqdfgXzGcXu3Y7Qs2JwQWUnWAiqlYlktpM/MTN4fx6JPQfTh+MT1//nEBq1pnog31LWWQiZz5TDSAs3JGZm31EvMCyqlkogElNI4RZyWxKV3LovqWXK/wV+MLVjSimxRrUQVwwnh3GiOhBrrlJ5C2rdZCvGKZU4GueSMAb3sNwchie4xcrIkOj32t8Q8aI3ntbDOspBA= X-MS-TrafficTypeDiagnostic: CY4PR12MB1142: X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;20:di+kH9/WEt2e+5RlmOEryV0B9J7Tnfz95nGgNVBFVXXxLhVNCXt6s3rpAg/qTNfHkdcS43XIT19EBk/h+dI8MgaZlle2WkEHJIztoGGfSC0Kvr4vfd5p16odxTvBh+8NhwSXjDv05aTumHZ2D75IZ/+YM6oZ+TAzrss/AqHGoq++jvDjNX1MvLO7NtWBQENoq7DUo0G1IqUM1Z54XUtAIf2h+IKXO4JSAXVry2bY0eoLLNNrbcqbbrxb8o8rIqmTpaOy0a2nRAhicrpmHL5JkbYUjfHGOnvmkbCDh2XleoV0ftLdyeLCg3oYFYNpChM9Bf51RhveF0H4jdU0Exr4F4ht7rlXdOmL/7ldhnreuYIzJPY3N/vTLlms+8bfLB7i3qJBhuffZ12tZI5dYJawiM7x+8wwV0/sYHr4lZPfBpkgtAg1xlWVyJaVOzaRMw3LxtmWuOPGNujQfMLfx4V71qVrYuhLDFV8xGJsa3VZYyLA2S/3cJPG24CU5C33O+da;4:nyRtbr6gnWN1HQ2VwOeg+E0DIOYlH1Y9ePURmnQyjlafufWnp9O8NayCmoBH747TZgzVEiqvAcED2p2Q77zP/eE4eGUxl8OU48zBeUdEQu2ol5hZbnN0kt0dfUtVHjt7wUHn3FJmDl7dp6zmzwQsVeaAiJiQy3z6L/ZrVm1+HLzKI3eZ19HiHskIfqhXMSHmt2WQA9ra/HA64P8dXGympRsWlobjwOtO2zUd1xvzMTVJqU6Rl868bL6rYku8dKcyLhrJ7b++b7eq05WKdSISyFJ7B90zbm+d9upU6nstXTI= X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY4PR12MB1142;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY4PR12MB1142; X-Forefront-PRVS: 0402872DA1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(6049001)(39830400002)(51444003)(199003)(51914003)(189002)(24454002)(377454003)(36756003)(53546010)(53936002)(83506001)(77096006)(72206003)(31696002)(6486002)(478600001)(86362001)(54906002)(81156014)(7416002)(5660300001)(90366009)(7406005)(65826007)(81166006)(97736004)(4001350100001)(229853002)(65956001)(6246003)(66066001)(189998001)(65806001)(47776003)(8676002)(305945005)(7736002)(230700001)(105586002)(7350300001)(2906002)(68736007)(23676002)(3846002)(6666003)(2950100002)(54356999)(6116002)(6636002)(50986999)(76176999)(50466002)(101416001)(4326008)(3260700006)(25786009)(31686004)(106356001)(42186005)(33646002)(64126003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1142;H:[10.236.64.250];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQyOzIzOnU2RTJOeE1oTEp0RGc3SmNPcjlFZnNtL2pD?= =?utf-8?B?QWNJSDJqR24vQmdtU0Q4eS96WWlNRDVsVTZDOVlYNlh2WFc0SEtoTmhiNFZQ?= =?utf-8?B?M2pHOC9ZQ01pYWxyd0JTdkIrRFEyaFFIS3FXek5iUDR1eTY3dmFKWX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KnumgAvgmE4SaCPhQE/tG9gECaH+2A56C/l08aGdqLykE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;20:udhw0G74qH5dpLSvdsBzsTr3g+isJw86v6qGylGSCuSQsMoxnbdy/1hKIvLWaiAlDseABZfa3Z7AbGlamFJvVxrJh9HVSV6slGOU8EhjO+kR9i5+rjIgkIUCyP4980SMQpORAbRQmYPi+PZt5SkyoEQ3v5G8nqUcinLXHlb1F4un95YldJFwUUCfhsrjogEUdX6Z21E5zlYkgLL+41JQmKwN1GIkW/Hhnzi3s7/CdqAqw+grKgU+E9pUFYih3IqO X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2017 18:55:22.9733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1142 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 47 On 7/28/2017 10:23 AM, Borislav Petkov wrote: > On Mon, Jul 24, 2017 at 02:07:49PM -0500, Brijesh Singh wrote: >> From: Tom Lendacky >> >> The walk_iomem_res_desc(), walk_system_ram_res() and walk_system_ram_range() >> functions each have much of the same code. Create a new function that >> consolidates the common code from these functions in one place to reduce >> the amount of duplicated code. >> >> Signed-off-by: Tom Lendacky >> Signed-off-by: Brijesh Singh >> --- >> kernel/resource.c | 53 ++++++++++++++++++++++++++--------------------------- >> 1 file changed, 26 insertions(+), 27 deletions(-) >> >> diff --git a/kernel/resource.c b/kernel/resource.c >> index 9b5f044..7b20b3e 100644 >> --- a/kernel/resource.c >> +++ b/kernel/resource.c >> @@ -397,9 +397,30 @@ static int find_next_iomem_res(struct resource *res, unsigned long desc, >> res->start = p->start; >> if (res->end > p->end) >> res->end = p->end; >> + res->desc = p->desc; >> return 0; > > I must be going blind: where are we using that res->desc? I think that was left-over from the initial consolidation work I was doing. I'll remove it. > >> +static int __walk_iomem_res_desc(struct resource *res, unsigned long desc, >> + bool first_level_children_only, > > Btw, that variable name is insanely long. I know, but I'm maintaining consistency with the name that was already present vs. changing it. > > The rest looks ok to me, thanks for the cleanup! Thanks, Tom >