diff mbox

[3/7] s390/kernel: Update /proc/sysinfo file with Extended Name and UUID

Message ID 1423043092-34044-4-git-send-email-borntraeger@de.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christian Borntraeger Feb. 4, 2015, 9:44 a.m. UTC
From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>

Read the additional data fields (Extended Name and UUID) from the
1KB block returned by the STSI command and reflect this information in
the /proc/sysinfo file accordingly

Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/include/asm/sysinfo.h | 10 +++++++---
 arch/s390/kernel/sysinfo.c      | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini Feb. 4, 2015, 12:57 p.m. UTC | #1
On 04/02/2015 10:44, Christian Borntraeger wrote:
> From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
> 
> Read the additional data fields (Extended Name and UUID) from the
> 1KB block returned by the STSI command and reflect this information in
> the /proc/sysinfo file accordingly
> 
> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Why should this go in via KVM? :)

Paolo

> ---
>  arch/s390/include/asm/sysinfo.h | 10 +++++++---
>  arch/s390/kernel/sysinfo.c      | 29 +++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
> index f92428e..9f8f2b5 100644
> --- a/arch/s390/include/asm/sysinfo.h
> +++ b/arch/s390/include/asm/sysinfo.h
> @@ -15,6 +15,7 @@
>  #define __ASM_S390_SYSINFO_H
>  
>  #include <asm/bitsperlong.h>
> +#include <linux/uuid.h>
>  
>  struct sysinfo_1_1_1 {
>  	unsigned char p:1;
> @@ -112,10 +113,13 @@ struct sysinfo_3_2_2 {
>  		char name[8];
>  		unsigned int caf;
>  		char cpi[16];
> -		char reserved_1[24];
> -
> +		char reserved_1[3];
> +		char ext_name_encoding;
> +		unsigned int reserved_2;
> +		uuid_be uuid;
>  	} vm[8];
> -	char reserved_544[3552];
> +	char reserved_3[1504];
> +	char ext_names[8][256];
>  };
>  
>  extern int topology_max_mnest;
> diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
> index 811f542..cebab77 100644
> --- a/arch/s390/kernel/sysinfo.c
> +++ b/arch/s390/kernel/sysinfo.c
> @@ -196,6 +196,33 @@ static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info)
>  	seq_printf(m, "LPAR CPUs Shared:     %d\n", info->cpus_shared);
>  }
>  
> +static void print_ext_name(struct seq_file *m, int lvl,
> +			   struct sysinfo_3_2_2 *info)
> +{
> +	if (info->vm[lvl].ext_name_encoding == 0)
> +		return;
> +	if (info->ext_names[lvl][0] == 0)
> +		return;
> +	switch (info->vm[lvl].ext_name_encoding) {
> +	case 1: /* EBCDIC */
> +		EBCASC(info->ext_names[lvl], sizeof(info->ext_names[lvl]));
> +		break;
> +	case 2:	/* UTF-8 */
> +		break;
> +	default:
> +		return;
> +	}
> +	seq_printf(m, "VM%02d Extended Name:   %-.256s\n", lvl,
> +		   info->ext_names[lvl]);
> +}
> +
> +static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
> +{
> +	if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be)))
> +		return;
> +	seq_printf(m, "VM%02d UUID:            %pUb\n", i, &info->vm[i].uuid);
> +}
> +
>  static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info)
>  {
>  	int i;
> @@ -213,6 +240,8 @@ static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info)
>  		seq_printf(m, "VM%02d CPUs Configured: %d\n", i, info->vm[i].cpus_configured);
>  		seq_printf(m, "VM%02d CPUs Standby:    %d\n", i, info->vm[i].cpus_standby);
>  		seq_printf(m, "VM%02d CPUs Reserved:   %d\n", i, info->vm[i].cpus_reserved);
> +		print_ext_name(m, i, info);
> +		print_uuid(m, i, info);
>  	}
>  }
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christian Borntraeger Feb. 4, 2015, 1:01 p.m. UTC | #2
Am 04.02.2015 um 13:57 schrieb Paolo Bonzini:
> 
> 
> On 04/02/2015 10:44, Christian Borntraeger wrote:
>> From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>>
>> Read the additional data fields (Extended Name and UUID) from the
>> 1KB block returned by the STSI command and reflect this information in
>> the /proc/sysinfo file accordingly
>>
>> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
>> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> Why should this go in via KVM? :)

Because we are being the first that will implement the architecture (
the other side so to speak). 
Heiko gave his ack so this shoudl be fine. If you prefer I can certainly push
that via Martin/Heiko.


Christian

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paolo Bonzini Feb. 4, 2015, 1:03 p.m. UTC | #3
On 04/02/2015 14:01, Christian Borntraeger wrote:
> Am 04.02.2015 um 13:57 schrieb Paolo Bonzini:
>>
>>
>> On 04/02/2015 10:44, Christian Borntraeger wrote:
>>> From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>>>
>>> Read the additional data fields (Extended Name and UUID) from the
>>> 1KB block returned by the STSI command and reflect this information in
>>> the /proc/sysinfo file accordingly
>>>
>>> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>>> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
>>> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>
>> Why should this go in via KVM? :)
> 
> Because we are being the first that will implement the architecture (
> the other side so to speak). 
> Heiko gave his ack so this shoudl be fine. If you prefer I can certainly push
> that via Martin/Heiko.

No problem.  Perhaps edit the commit message?

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christian Borntraeger Feb. 4, 2015, 7:32 p.m. UTC | #4
Am 04.02.2015 um 14:03 schrieb Paolo Bonzini:
> 
> 
> On 04/02/2015 14:01, Christian Borntraeger wrote:
>> Am 04.02.2015 um 13:57 schrieb Paolo Bonzini:
>>>
>>>
>>> On 04/02/2015 10:44, Christian Borntraeger wrote:
>>>> From: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>>>>
>>>> Read the additional data fields (Extended Name and UUID) from the
>>>> 1KB block returned by the STSI command and reflect this information in
>>>> the /proc/sysinfo file accordingly
>>>>
>>>> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
>>>> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
>>>> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
>>>> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
>>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>>
>>> Why should this go in via KVM? :)
>>
>> Because we are being the first that will implement the architecture (
>> the other side so to speak). 
>> Heiko gave his ack so this shoudl be fine. If you prefer I can certainly push
>> that via Martin/Heiko.
> 
> No problem.  Perhaps edit the commit message?

Something like

A new architecture extends STSI 3.2.2 with UUID and long names. KVM will
provide the first implementation. This patch adds the additional data 
fields (Extended Name and UUID) from the 4KB block returned by the STSI 
3.2.2 command and reflect this information in the /proc/sysinfo file
accordingly. 
This is is non-KVM code, but developed by the KVM team. The patch is 
acked by Heiko Carstens to go over the KVM tree.

Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

?

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paolo Bonzini Feb. 5, 2015, 11:13 a.m. UTC | #5
On 04/02/2015 20:32, Christian Borntraeger wrote:
> 
> A new architecture extends STSI 3.2.2 with UUID and long names. KVM will
> provide the first implementation. This patch adds the additional data 
> fields (Extended Name and UUID) from the 4KB block returned by the STSI 
> 3.2.2 command and reflect this information in the /proc/sysinfo file
> accordingly. 

Great.

> This is is non-KVM code, but developed by the KVM team. The patch is 
> acked by Heiko Carstens to go over the KVM tree.

The last two lines are not even necessary (the explanation of "why" is
in the first paragraph, the explanation of "how" is in the
Signed-off-bys and Acked-by).

Paolo

> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index f92428e..9f8f2b5 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -15,6 +15,7 @@ 
 #define __ASM_S390_SYSINFO_H
 
 #include <asm/bitsperlong.h>
+#include <linux/uuid.h>
 
 struct sysinfo_1_1_1 {
 	unsigned char p:1;
@@ -112,10 +113,13 @@  struct sysinfo_3_2_2 {
 		char name[8];
 		unsigned int caf;
 		char cpi[16];
-		char reserved_1[24];
-
+		char reserved_1[3];
+		char ext_name_encoding;
+		unsigned int reserved_2;
+		uuid_be uuid;
 	} vm[8];
-	char reserved_544[3552];
+	char reserved_3[1504];
+	char ext_names[8][256];
 };
 
 extern int topology_max_mnest;
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index 811f542..cebab77 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -196,6 +196,33 @@  static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info)
 	seq_printf(m, "LPAR CPUs Shared:     %d\n", info->cpus_shared);
 }
 
+static void print_ext_name(struct seq_file *m, int lvl,
+			   struct sysinfo_3_2_2 *info)
+{
+	if (info->vm[lvl].ext_name_encoding == 0)
+		return;
+	if (info->ext_names[lvl][0] == 0)
+		return;
+	switch (info->vm[lvl].ext_name_encoding) {
+	case 1: /* EBCDIC */
+		EBCASC(info->ext_names[lvl], sizeof(info->ext_names[lvl]));
+		break;
+	case 2:	/* UTF-8 */
+		break;
+	default:
+		return;
+	}
+	seq_printf(m, "VM%02d Extended Name:   %-.256s\n", lvl,
+		   info->ext_names[lvl]);
+}
+
+static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
+{
+	if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be)))
+		return;
+	seq_printf(m, "VM%02d UUID:            %pUb\n", i, &info->vm[i].uuid);
+}
+
 static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info)
 {
 	int i;
@@ -213,6 +240,8 @@  static void stsi_3_2_2(struct seq_file *m, struct sysinfo_3_2_2 *info)
 		seq_printf(m, "VM%02d CPUs Configured: %d\n", i, info->vm[i].cpus_configured);
 		seq_printf(m, "VM%02d CPUs Standby:    %d\n", i, info->vm[i].cpus_standby);
 		seq_printf(m, "VM%02d CPUs Reserved:   %d\n", i, info->vm[i].cpus_reserved);
+		print_ext_name(m, i, info);
+		print_uuid(m, i, info);
 	}
 }