Path: csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod From: =?UTF-8?Q?Philip_M=c3=bcller?= Newsgroups: linux.kernel Subject: Re: [PATCH] cpu/cacheinfo: Fix teardown path Date: Sun, 13 Sep 2015 09:30:01 +0200 Message-ID: References: X-Original-To: Borislav Petkov , Greg KH X-Greylist: delayed 1104 seconds by postgrey-1.27 at vger.kernel.org; Sun, 13 Sep 2015 03:22:26 EDT MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050303040908060702070403" Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 77 Organization: linux.* mail to news gateway X-Original-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 X-Original-Date: Sun, 13 Sep 2015 09:03:56 +0200 X-Original-Message-ID: <55F51FDC.9090108@manjaro.org> X-Original-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> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1223557 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-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/