Skip to contentSkip to conversation

Clean up arch_get_xen_caps() to not use sprintf().

Xen-staging Alex Williamson 5 participants 6 messages Jan 31, 2007 – Feb 1, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines · Xen staging patchbot-unstable

diff -r bd69e83b65ea -r 9578ae319874 xen/arch/ia64/xen/xensetup.c

xen/arch/ia64/xen/xensetup.c +0 -1
@@ -547,18 +547,19 @@ printk("num_online_cpus=%d, max_cpus=%d\
 
 void arch_get_xen_caps(xen_capabilities_info_t info)
 {
-    char *p=info;

xen/arch/ia64/xen/xensetup.c printk("num_online_cpus=%d, max_cpus=%d\ · line 557

Quoted 10 lines
xen/arch/ia64/xen/xensetup.c +6 -2
     int major = xen_major_version();
     int minor = xen_minor_version();
-
-    p += snprintf(p,sizeof(info), "xen-%d.%d-ia64 ", major, minor);
+    char s[32];
+
+    info[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-ia54 ", major, minor);
+    safe_strcat(info, s);

This doesn't work. info is just a char* here, so the sizeof() in
safe_strcat() only cats the first 8 bytes (or 4 on x86_32 I suppose). Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.
#2 lore raw
Quoted 6 lines · Alex Williamson
Quoted 5 lines · Xen staging patchbot-unstable

diff -r bd69e83b65ea -r 9578ae319874 xen/arch/ia64/xen/xensetup.c

xen/arch/ia64/xen/xensetup.c +0 -0
@@ -547,18 +547,19 @@ printk("num_online_cpus=%d, max_cpus=%d\
 
Quoted 16 lines

xen/arch/ia64/xen/xensetup.c printk("num_online_cpus=%d, max_cpus=%d\ · line 557

Quoted 13 lines
xen/arch/ia64/xen/xensetup.c +6 -3
 void arch_get_xen_caps(xen_capabilities_info_t info)
 {
-    char *p=info;
     int major = xen_major_version();
     int minor = xen_minor_version();
-
-    p += snprintf(p,sizeof(info), "xen-%d.%d-ia64 ", major, minor);
+    char s[32];
+
+    info[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-ia54 ", major, minor);
+    safe_strcat(info, s);

This doesn't work. info is just a char* here, so the sizeof() in
safe_strcat() only cats the first 8 bytes (or 4 on x86_32 I suppose).

And there's a typo, ia64, not 54. Thanks,

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.
#3 lore raw
Quoted 24 lines · Alex Williamson
Quoted 6 lines · Alex Williamson
Quoted 5 lines · Xen staging patchbot-unstable

diff -r bd69e83b65ea -r 9578ae319874 xen/arch/ia64/xen/xensetup.c

xen/arch/ia64/xen/xensetup.c +0 -0
@@ -547,18 +547,19 @@ printk("num_online_cpus=%d, max_cpus=%d\
 
Quoted 16 lines

xen/arch/ia64/xen/xensetup.c printk("num_online_cpus=%d, max_cpus=%d\ · line 557

Quoted 13 lines
xen/arch/ia64/xen/xensetup.c +6 -3
 void arch_get_xen_caps(xen_capabilities_info_t info)
 {
-    char *p=info;
     int major = xen_major_version();
     int minor = xen_minor_version();
-
-    p += snprintf(p,sizeof(info), "xen-%d.%d-ia64 ", major, minor);
+    char s[32];
+
+    info[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-ia54 ", major, minor);
+    safe_strcat(info, s);

This doesn't work. info is just a char* here, so the sizeof() in
safe_strcat() only cats the first 8 bytes (or 4 on x86_32 I suppose).

Quoted 1 line

And there's a typo, ia64, not 54. Thanks,

Fixed both of these, thanks for the heads up.

Ian.

#4 lore raw

about eventchannel

In reply to Alex Williamson

Hi
I try to understand the eventchannel part,
and I am confused by the differences of the physical IRQ line ,virtual IRQ line and virtual IPI line

for a vm , what do the physical IRQ line and virtual IRQ line mean for? Every vm has one or some vcpu ,then virtual IRQ line may be related with one of these vcpu , then what is the physical IRQ line for? I am really confused with it

could someone give me help
Thanks in advance

#5 lore raw

Re: about eventchannel

Hi,

Quoted 3 lines

I try to understand the eventchannel part,
and I am confused by the differences of the physical IRQ line ,virtual IRQ line and virtual IPI line

Physical IRQ lines correspond to actual IRQs from real hardware devices. Guests receive an event channel notification for a physical IRQ line if there is an interrupt generated by that device.

A virtual IRQ is something that is generated by Xen, e.g. the domain's timer interrupt.

The virtual IPI lines are interdomain event channels, allowing domains to notify each other (for instance to notify that there's data waiting for processing in a shared memory buffer).

Cheers,
Mark

Quoted 14 lines

for a vm , what do the physical IRQ line and virtual IRQ line mean for? Every vm has one or some vcpu ,then virtual IRQ line may be related with one of these vcpu , then what is the physical IRQ line for? I am really confused with it

could someone give me help
Thanks in advance

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!
#6 lore raw

RE: about eventchannel

Quoted 15 lines

From: Mark Williamson
Sent: 2007年2月1日 4:48

Hi,

Quoted 3 lines

I try to understand the eventchannel part,
and I am confused by the differences of the physical IRQ line ,virtual IRQ line and virtual IPI line

Physical IRQ lines correspond to actual IRQs from real hardware devices.
Guests receive an event channel notification for a physical IRQ line if there
is an interrupt generated by that device.

Quoted 7 lines

A virtual IRQ is something that is generated by Xen, e.g. the domain's timer
interrupt.

The virtual IPI lines are interdomain event channels, allowing domains to notify each other (for instance to notify that there's data waiting for processing in a shared memory buffer).

I would say virtual IPI lines are inter-vcpu event channels within one domain, which just behaves like physical IPI. Then we can consider rest out of above 3 categories into inter-domain event ports. :-)

Thanks,
Kevin