From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbbIMHW2 (ORCPT ); Sun, 13 Sep 2015 03:22:28 -0400 Received: from static.148.38.9.176.clients.your-server.de ([176.9.38.148]:48619 "EHLO manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbbIMHW1 (ORCPT ); Sun, 13 Sep 2015 03:22:27 -0400 X-Greylist: delayed 1104 seconds by postgrey-1.27 at vger.kernel.org; Sun, 13 Sep 2015 03:22:26 EDT Subject: Re: [PATCH] cpu/cacheinfo: Fix teardown path To: Borislav Petkov , Greg KH References: <55B16967.1040609@manjaro.org> <55B47BB8.6080202@manjaro.org> <20150727075805.GA20416@nazgul.tnic> <20150808084602.GA24212@nazgul.tnic> <20150808154156.GC11851@kroah.com> <20150808194736.GB4242@nazgul.tnic> Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Sudeep Holla , Guenter Roeck , manjaro-dev@manjaro.org, Ingo Molnar , "H. Peter Anvin" , Andre Przywara , manjaro-dev@manjaro.org From: =?UTF-8?Q?Philip_M=c3=bcller?= Message-ID: <55F51FDC.9090108@manjaro.org> Date: Sun, 13 Sep 2015 09:03:56 +0200 MIME-Version: 1.0 In-Reply-To: <20150808194736.GB4242@nazgul.tnic> Content-Type: multipart/mixed; boundary="------------050303040908060702070403" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------050303040908060702070403 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 08.08.2015 21:47, Borislav Petkov wrote: > On Sat, Aug 08, 2015 at 08:41:56AM -0700, Greg KH wrote: >> What commit caused this issue? > > Apparently > > 0d55ba46bfbe ("x86/cacheinfo: Move cacheinfo sysfs code to generic infrastructure") > > Looks like moving x86 to the generic cacheinfo stuff uncovered this > shortcoming there... > >> And it's a bit late for 4.2, as you say 4.1 is also affected, I'll wait >> for 4.3-rc1 to give this a chance to get some testing. > > Right, I guess that's fine too as it'll trickle to stable eventually... > > Thanks. > Just a note from my end. Seems this patch didn't made it into 4.3-rc1. Any reason why? --------------050303040908060702070403 Content-Type: text/x-patch; name="0001-cpu-cacheinfo-fix-teardown-path.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-cpu-cacheinfo-fix-teardown-path.patch" diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 764280a91776..e9fd32e91668 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -148,7 +148,11 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) if (sibling == cpu) /* skip itself */ continue; + sib_cpu_ci = get_cpu_cacheinfo(sibling); + if (!sib_cpu_ci->info_list) + continue; + sib_leaf = sib_cpu_ci->info_list + index; cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map); @@ -159,6 +163,9 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) static void free_cache_attributes(unsigned int cpu) { + if (!per_cpu_cacheinfo(cpu)) + return; + cache_shared_cpu_map_remove(cpu); kfree(per_cpu_cacheinfo(cpu)); @@ -514,8 +521,7 @@ static int cacheinfo_cpu_callback(struct notifier_block *nfb, break; case CPU_DEAD: cache_remove_dev(cpu); - if (per_cpu_cacheinfo(cpu)) - free_cache_attributes(cpu); + free_cache_attributes(cpu); break; } return notifier_from_errno(rc); --------------050303040908060702070403--