Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765401AbYHHWNB (ORCPT ); Fri, 8 Aug 2008 18:13:01 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762925AbYHHWAX (ORCPT ); Fri, 8 Aug 2008 18:00:23 -0400 Received: from gprs189-60.eurotel.cz ([160.218.189.60]:3921 "EHLO spitz.ucw.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1761990AbYHHWAV (ORCPT ); Fri, 8 Aug 2008 18:00:21 -0400 Date: Sat, 9 Aug 2008 00:00:11 +0200 From: Pavel Machek To: Mark Langsdorf , gregkh@ucw.cz Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/01] x86: L3 cache index disable for 2.6.26 Message-ID: <20080808220011.GA12156@ucw.cz> References: <200807181603.52332.mark.langsdorf@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200807181603.52332.mark.langsdorf@amd.com> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1763 Lines: 54 Hi! > New versions of AMD processors have support to disable parts > of their L3 caches if too many MCEs are generated by the > L3 cache. > > This patch provides a /sysfs interface under the cache > hierarchy to display which caches indices are disabled > (if any) and to monitoring applications to disable a > cache index. ... > +static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf) > +{ > + struct pci_dev *dev; > + if (this_leaf->can_disable) { > + int i; > + ssize_t ret = 0; > + int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); > + dev = k8_northbridges[node]; > + > + for (i = 0; i < 2; i++) { > + unsigned int reg; > + pci_read_config_dword(dev, 0x1BC + i * 4, ®); > + ret += sprintf(buf, "%sEntry: %d\n", buf, i); > + ret += sprintf(buf, "%sReads: %s\tNew Entries: %s\n", > + buf, > + reg & 0x80000000 ? "Disabled" : "Allowed", > + reg & 0x40000000 ? "Disabled" : "Allowed"); > + ret += sprintf(buf, "%sSubCache: %x\tIndex: %x\n", buf, > + (reg & 0x30000) >> 16, reg & 0xfff); > + > + } > + return ret; > + } > + return sprintf(buf, "Feature not enabled\n"); > +} I think there's one-value-per-file rule in sysfs... I guess it is better to return -EOPNOTSUP (or something) instead of english text explaining that... No, really, what you created is impossible to parse -- /proc like nightmare. -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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/