[libvirt] [PATCH] Buffer size too small when reading sysinfo on S390

On a system with 160 CPUs the /proc/cpuinfo size grows beyond the currently set limit of 10KB causing an internal error. This patch increases the buffer size for S390 to 64KB. Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- src/util/virsysinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 1bb6392..613bab9 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -377,6 +377,8 @@ virSysinfoRead(void) # pragma GCC diagnostic ignored "-Wlogical-op" # endif +# define S390_CPUINFO_FILE_LEN (64*1024) /* 64KB limit for /proc/cpuinfo file */ + static char * virSysinfoParseDelimited(const char *base, const char *name, char **value, char delim1, char delim2) @@ -471,7 +473,7 @@ virSysinfoRead(void) goto no_memory; /* Gather info from /proc/cpuinfo */ - if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, S390_CPUINFO_FILE_LEN, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL; -- 1.9.3

On Mon, Dec 15, 2014 at 14:16:31 +0100, Boris Fiuczynski wrote:
On a system with 160 CPUs the /proc/cpuinfo size grows beyond the currently set limit of 10KB causing an internal error.
This patch increases the buffer size for S390 to 64KB.
Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> --- src/util/virsysinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 1bb6392..613bab9 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -377,6 +377,8 @@ virSysinfoRead(void) # pragma GCC diagnostic ignored "-Wlogical-op" # endif
+# define S390_CPUINFO_FILE_LEN (64*1024) /* 64KB limit for /proc/cpuinfo file */ + static char * virSysinfoParseDelimited(const char *base, const char *name, char **value, char delim1, char delim2) @@ -471,7 +473,7 @@ virSysinfoRead(void) goto no_memory;
/* Gather info from /proc/cpuinfo */ - if (virFileReadAll(CPUINFO, CPUINFO_FILE_LEN, &outbuf) < 0) { + if (virFileReadAll(CPUINFO, S390_CPUINFO_FILE_LEN, &outbuf) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to open %s"), CPUINFO); return NULL;
I don't think this needs to be S390 specific. Why can't we just increase CPUINFO_FILE_LEN to, e.g., 1MB? Jirka

On 12/15/2014 06:57 AM, Jiri Denemark wrote:
On Mon, Dec 15, 2014 at 14:16:31 +0100, Boris Fiuczynski wrote:
On a system with 160 CPUs the /proc/cpuinfo size grows beyond the currently set limit of 10KB causing an internal error.
This patch increases the buffer size for S390 to 64KB.
I don't think this needs to be S390 specific. Why can't we just increase CPUINFO_FILE_LEN to, e.g., 1MB?
I tend to agree; it shouldn't hurt to make the limit larger for everyone. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 12/15/2014 07:02 PM, Eric Blake wrote:
On 12/15/2014 06:57 AM, Jiri Denemark wrote:
On Mon, Dec 15, 2014 at 14:16:31 +0100, Boris Fiuczynski wrote:
On a system with 160 CPUs the /proc/cpuinfo size grows beyond the currently set limit of 10KB causing an internal error.
This patch increases the buffer size for S390 to 64KB.
I don't think this needs to be S390 specific. Why can't we just increase CPUINFO_FILE_LEN to, e.g., 1MB?
I tend to agree; it shouldn't hurt to make the limit larger for everyone.
OK, I have no problem doing that. Not sure if we want to really go up to 1MB. Doing some quick calculation: 1 MB would result in more than 1,500 CPUs on x86 and more than 13,000 CPUs on S390. Well, at least it will for sure be large enough for some time. :) -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (3)
-
Boris Fiuczynski
-
Eric Blake
-
Jiri Denemark