Re: [PATCH 3/4] ksysfs: export VMCSINFO via sysfs

2012-04-16 Thread Greg KH
On Tue, Apr 17, 2012 at 09:52:42AM +0800, zhangyanfei wrote:
 于 2012年04月13日 07:00, Greg KH 写道:
  On Wed, Apr 11, 2012 at 09:57:34AM +0800, zhangyanfei wrote:
  This patch creates sysfs file to export where VMCSINFO is allocated,
  as below:
  $ cat /sys/kernel/vmcsinfo
  1cb88a0 2000
  number on the left-hand side is the physical address of VMCSINFO,
  while the one on the right-hand side is the max size of VMCSINFO.
  
  Ick, why do you have 2 values in one sysfs file, that's not nice, or
  good.
  
  What's wrong with 2 different files?
  
 
 The reason why I put the 2 values in one sysfs file is that there is a similar
 file 'vmcoreinfo' in sysfs.
 # cat /sys/kernel/vmcoreinfo 
 1d75380 1000

Then that should be fixed as well, using two different file names now :(

thanks,

greg k-h

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


Re: [PATCH 3/4] ksysfs: export VMCSINFO via sysfs

2012-04-12 Thread Greg KH
On Wed, Apr 11, 2012 at 09:57:34AM +0800, zhangyanfei wrote:
 This patch creates sysfs file to export where VMCSINFO is allocated,
 as below:
 $ cat /sys/kernel/vmcsinfo
 1cb88a0 2000
 number on the left-hand side is the physical address of VMCSINFO,
 while the one on the right-hand side is the max size of VMCSINFO.

Ick, why do you have 2 values in one sysfs file, that's not nice, or
good.

What's wrong with 2 different files?

Also, any new sysfs file you add needs to also have a Documentation/ABI
entry added as well.

But we can't accept this as-is, sorry, please split it up into 2 files.

greg k-h

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


[PATCH 3/4] ksysfs: export VMCSINFO via sysfs

2012-04-10 Thread zhangyanfei
This patch creates sysfs file to export where VMCSINFO is allocated,
as below:
$ cat /sys/kernel/vmcsinfo
1cb88a0 2000
number on the left-hand side is the physical address of VMCSINFO,
while the one on the right-hand side is the max size of VMCSINFO.

Signed-off-by: zhangyanfei zhangyan...@cn.fujitsu.com
---
 kernel/ksysfs.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 4e316e1..becbb68 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -18,6 +18,8 @@
 #include linux/stat.h
 #include linux/sched.h
 #include linux/capability.h
+#include asm/vmcsinfo.h
+#include asm/virtext.h
 
 #define KERNEL_ATTR_RO(_name) \
 static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
@@ -133,6 +135,20 @@ KERNEL_ATTR_RO(vmcoreinfo);
 
 #endif /* CONFIG_KEXEC */
 
+#ifdef CONFIG_X86
+static ssize_t vmcsinfo_show(struct kobject *kobj,
+struct kobj_attribute *attr, char *buf)
+{
+   if (cpu_has_vmx())
+   return sprintf(buf, %lx %x\n,
+  paddr_vmcsinfo_note(),
+  (unsigned int)vmcsinfo_max_size);
+   return 0;
+}
+KERNEL_ATTR_RO(vmcsinfo);
+
+#endif /* CONFIG_X86 */
+
 /* whether file capabilities are enabled */
 static ssize_t fscaps_show(struct kobject *kobj,
  struct kobj_attribute *attr, char *buf)
@@ -182,6 +198,9 @@ static struct attribute * kernel_attrs[] = {
kexec_crash_size_attr.attr,
vmcoreinfo_attr.attr,
 #endif
+#ifdef CONFIG_X86
+   vmcsinfo_attr.attr,
+#endif
NULL
 };
 
-- 
1.7.1

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec