debuggers.hg
changeset 16659:a7ede5cb628a
merge with xen-unstable.hg (staging)
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Fri Dec 14 10:12:40 2007 -0700 (2007-12-14) |
parents | 19c2b6d2930c 966a6d3b7408 |
children | e6069a715fd7 |
files |
line diff
1.1 --- a/docs/misc/vtd.txt Thu Dec 13 09:34:49 2007 -0700 1.2 +++ b/docs/misc/vtd.txt Fri Dec 14 10:12:40 2007 -0700 1.3 @@ -2,7 +2,7 @@ Title : How to do PCI Passthrough with 1.4 Authors : Allen Kay <allen.m.kay@intel.com> 1.5 Weidong Han <weidong.han@intel.com> 1.6 Created : October-24-2007 1.7 -Updated : December-11-2007 1.8 +Updated : December-13-2007 1.9 1.10 How to turn on VT-d in Xen 1.11 -------------------------- 1.12 @@ -41,6 +41,22 @@ PCIe-to-PCI bridge have to be assigned t 1.13 PCIe devices do not have this restriction. 1.14 1.15 1.16 +VT-d Works on OS: 1.17 +----------------- 1.18 + 1.19 +1) Host OS: PAE, 64-bit 1.20 +2) Guest OS: 32-bit, PAE, 64-bit 1.21 + 1.22 +Because current Xen doesn't support MSI, for guest OS which uses MSI by default, need to add "pci=nomsi" option on its grub, e.g. RHEL5, FC6. 1.23 + 1.24 + 1.25 +Combinations Tested: 1.26 +-------------------- 1.27 + 1.28 +1) 64-bit host: 32/PAE/64 Linux/XP/Win2003/Vista guests 1.29 +2) PAE host: 32/PAE Linux/XP/Win2003/Vista guests 1.30 + 1.31 + 1.32 VT-d Enabled Systems 1.33 -------------------- 1.34
2.1 --- a/docs/misc/xenstore.txt Thu Dec 13 09:34:49 2007 -0700 2.2 +++ b/docs/misc/xenstore.txt Fri Dec 14 10:12:40 2007 -0700 2.3 @@ -38,7 +38,9 @@ The permitted character for paths set is 2.4 the four punctuation characters -/_@ (hyphen slash underscore atsign). 2.5 @ should be avoided except to specify special watches (see below). 2.6 Doubled slashes and trailing slashes (except to specify the root) are 2.7 -forbidden. The empty path is also forbidden. 2.8 +forbidden. The empty path is also forbidden. Paths longer than 3072 2.9 +bytes are forbidden; clients specifying relative paths should keep 2.10 +them to within 2048 bytes. (See XENSTORE_*_PATH_MAX in xs_wire.h.) 2.11 2.12 2.13 Communication with xenstore is via either sockets, or event channel 2.14 @@ -56,6 +58,20 @@ order and must use req_id (and tx_id, if 2.15 replies to requests. (The current implementation always replies to 2.16 requests in the order received but this should not be relied on.) 2.17 2.18 +The payload length (len field of the header) is limited to 4096 2.19 +(XENSTORE_PAYLOAD_MAX) in both directions. If a client exceeds the 2.20 +limit, its xenstored connection will be immediately killed by 2.21 +xenstored, which is usually catastrophic from the client's point of 2.22 +view. Clients (particularly domains, which cannot just reconnect) 2.23 +should avoid this. 2.24 + 2.25 +Existing clients do not always contain defences against overly long 2.26 +payloads. Increasing xenstored's limit is therefore difficult; it 2.27 +would require negotiation with the client, and obviously would make 2.28 +parts of xenstore inaccessible to some clients. In any case passing 2.29 +bulk data through xenstore is not recommended as the performance 2.30 +properties are poor. 2.31 + 2.32 2.33 ---------- Xenstore protocol details - introduction ---------- 2.34 2.35 @@ -174,6 +190,17 @@ WATCH <wpath>|<token>|? 2.36 away, with <path> equal to <wpath>. Watches may be triggered 2.37 spuriously. The tx_id in a WATCH request is ignored. 2.38 2.39 + Watches are supposed to be restricted by the permissions 2.40 + system but in practice the implementation is imperfect. 2.41 + Applications should not rely on being sent a notification for 2.42 + paths that they cannot read; however, an application may rely 2.43 + on being sent a watch when a path which it _is_ able to read 2.44 + is deleted even if that leaves only a nonexistent unreadable 2.45 + parent. A notification may omitted if a node's permissions 2.46 + are changed so as to make it unreadable, in which case future 2.47 + notifications may be suppressed (and if the node is later made 2.48 + readable, some notifications may have been lost). 2.49 + 2.50 WATCH_EVENT <epath>|<token>| 2.51 Unsolicited `reply' generated for matching modfication events 2.52 as described above. req_id and tx_id are both 0. 2.53 @@ -182,7 +209,7 @@ WATCH_EVENT <epath>|<token>| 2.54 modifed; however if the event was the recursive removal of an 2.55 parent of <wpath>, <epath> is just 2.56 <wpath> (rather than the actual path which was removed). So 2.57 - <epath> is a child of <epath>, regardless. 2.58 + <epath> is a child of <wpath>, regardless. 2.59 2.60 Iff <wpath> for the watch was specified as a relative pathname, 2.61 the <epath> path will also be relative (with the same base, 2.62 @@ -192,7 +219,7 @@ UNWATCH <wpath>|<token>|? 2.63 2.64 ---------- Transactions ---------- 2.65 2.66 -TRANSACTION_START ?? <transid>| 2.67 +TRANSACTION_START | <transid>| 2.68 <transid> is an opaque uint32_t allocated by xenstored 2.69 represented as unsigned decimal. After this, transaction may 2.70 be referenced by using <transid> (as 32-bit binary) in the 2.71 @@ -202,11 +229,6 @@ TRANSACTION_START ?? <transid>| 2.72 Currently xenstored has the bug that after 2^32 transactions 2.73 it will allocate the transid 0 for an actual transaction. 2.74 2.75 - Clients using the provided xs.c bindings will send a single 2.76 - nul byte for the argument payload. We recommend that future 2.77 - clients continue to do the same; any future extension will not 2.78 - use that syntax. 2.79 - 2.80 TRANSACTION_END T| 2.81 TRANSACTION_END F| 2.82 tx_id must refer to existing transaction. After this
3.1 --- a/tools/libfsimage/Rules.mk Thu Dec 13 09:34:49 2007 -0700 3.2 +++ b/tools/libfsimage/Rules.mk Fri Dec 14 10:12:40 2007 -0700 3.3 @@ -27,6 +27,6 @@ fs-install: fs-all 3.4 $(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_CFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) 3.5 3.6 clean distclean: 3.7 - rm -f $(PIC_OBJS) $(FSLIB) 3.8 + rm -f $(PIC_OBJS) $(FSLIB) $(DEPS) 3.9 3.10 -include $(DEPS)
4.1 --- a/tools/libfsimage/common/Makefile Thu Dec 13 09:34:49 2007 -0700 4.2 +++ b/tools/libfsimage/common/Makefile Fri Dec 14 10:12:40 2007 -0700 4.3 @@ -32,7 +32,7 @@ install: all 4.4 $(INSTALL_DATA) fsimage_grub.h $(DESTDIR)/usr/include 4.5 4.6 clean distclean: 4.7 - rm -f $(PIC_OBJS) $(LIB) 4.8 + rm -f $(PIC_OBJS) $(LIB) $(DEPS) 4.9 4.10 libfsimage.so: libfsimage.so.$(MAJOR) 4.11 ln -sf $< $@
5.1 --- a/tools/libxc/Makefile Thu Dec 13 09:34:49 2007 -0700 5.2 +++ b/tools/libxc/Makefile Fri Dec 14 10:12:40 2007 -0700 5.3 @@ -125,7 +125,8 @@ TAGS: 5.4 clean: 5.5 rm -rf *.rpm $(LIB) *~ $(DEPS) xen \ 5.6 $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \ 5.7 - $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) 5.8 + $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) \ 5.9 + $(LIBELF_SRCS) libelf-private.h 5.10 5.11 .PHONY: rpm 5.12 rpm: build
6.1 --- a/tools/python/Makefile Thu Dec 13 09:34:49 2007 -0700 6.2 +++ b/tools/python/Makefile Fri Dec 14 10:12:40 2007 -0700 6.3 @@ -104,4 +104,4 @@ test: 6.4 6.5 .PHONY: clean 6.6 clean: 6.7 - rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/xsm/xsm.py 6.8 + rm -rf build *.pyc *.pyo *.o *.a *~ $(CATALOGS) xen/util/xsm/xsm.py xen/util/auxbin.pyc
7.1 --- a/tools/python/xen/util/xsm/acm/acm.py Thu Dec 13 09:34:49 2007 -0700 7.2 +++ b/tools/python/xen/util/xsm/acm/acm.py Fri Dec 14 10:12:40 2007 -0700 7.3 @@ -1545,21 +1545,44 @@ def get_security_label(self, xspol=None) 7.4 label = self.info.get('security_label', label) 7.5 return label 7.6 7.7 + 7.8 +__cond = threading.Condition() 7.9 +__script_runner = None 7.10 +__orders = [] 7.11 + 7.12 def run_resource_label_change_script(resource, label, command): 7.13 - def __run_resource_label_change_script(label, command): 7.14 + global __cond, __orders, __script_runner 7.15 + 7.16 + def __run_resource_label_change_script(): 7.17 + global __cond, __orders 7.18 script = XendOptions.instance().get_resource_label_change_script() 7.19 if script: 7.20 - parms = { 7.21 - 'resource' : resource, 7.22 - 'label' : label, 7.23 - 'command' : command, 7.24 - } 7.25 - log.info("Running resource label change script %s: %s" % 7.26 - (script, parms)) 7.27 - parms.update(os.environ) 7.28 - os.spawnve(os.P_WAIT, script[0], script, parms) 7.29 + parms = {} 7.30 + while True: 7.31 + __cond.acquire() 7.32 + if len(__orders) == 0: 7.33 + __cond.wait() 7.34 + 7.35 + parms['label'], \ 7.36 + parms['command'], \ 7.37 + parms['resource'] = __orders[0] 7.38 + 7.39 + __orders = __orders[1:] 7.40 + __cond.release() 7.41 + 7.42 + log.info("Running resource label change script %s: %s" % 7.43 + (script, parms)) 7.44 + parms.update(os.environ) 7.45 + os.spawnve(os.P_WAIT, script[0], script, parms) 7.46 else: 7.47 log.info("No script given for relabeling of resources.") 7.48 - thread = threading.Thread(target=__run_resource_label_change_script, 7.49 - args=(label,command)) 7.50 - thread.start() 7.51 + if not __script_runner: 7.52 + __script_runner = \ 7.53 + threading.Thread(target=__run_resource_label_change_script, 7.54 + args=()) 7.55 + __script_runner.start() 7.56 + 7.57 + __cond.acquire() 7.58 + __orders.append((label,command,resource)) 7.59 + __cond.notify() 7.60 + __cond.release()
8.1 --- a/tools/python/xen/util/xsm/dummy/dummy.py Thu Dec 13 09:34:49 2007 -0700 8.2 +++ b/tools/python/xen/util/xsm/dummy/dummy.py Fri Dec 14 10:12:40 2007 -0700 8.3 @@ -33,7 +33,6 @@ xmlrpc_exports = [ 8.4 def err(msg): 8.5 """Raise XSM-dummy exception. 8.6 """ 8.7 - sys.stderr.write("XSM-dummyError: " + msg + "\n") 8.8 raise XSMError(msg) 8.9 8.10 def on(): 8.11 @@ -123,3 +122,12 @@ def get_domain_label(domain): 8.12 8.13 def set_domain_label(): 8.14 err("Command not supported under xsm 'dummy' module.") 8.15 + 8.16 +def dump_policy(): 8.17 + pass 8.18 + 8.19 +def dump_policy_file(): 8.20 + pass 8.21 + 8.22 +def get_ssid(domain): 8.23 + err("No ssid has been assigned to any domain under xsm dummy module.")
9.1 --- a/tools/xenstore/xenstored_core.c Thu Dec 13 09:34:49 2007 -0700 9.2 +++ b/tools/xenstore/xenstored_core.c Fri Dec 14 10:12:40 2007 -0700 9.3 @@ -672,6 +672,9 @@ bool is_valid_nodename(const char *node) 9.4 if (strstr(node, "//")) 9.5 return false; 9.6 9.7 + if (strlen(node) > XENSTORE_ABS_PATH_MAX) 9.8 + return false; 9.9 + 9.10 return valid_chars(node); 9.11 } 9.12 9.13 @@ -1281,7 +1284,7 @@ static void handle_input(struct connecti 9.14 if (in->used != sizeof(in->hdr)) 9.15 return; 9.16 9.17 - if (in->hdr.msg.len > PATH_MAX) { 9.18 + if (in->hdr.msg.len > XENSTORE_PAYLOAD_MAX) { 9.19 syslog(LOG_ERR, "Client tried to feed us %i", 9.20 in->hdr.msg.len); 9.21 goto bad_client;
10.1 --- a/tools/xenstore/xenstored_watch.c Thu Dec 13 09:34:49 2007 -0700 10.2 +++ b/tools/xenstore/xenstored_watch.c Fri Dec 14 10:12:40 2007 -0700 10.3 @@ -125,6 +125,10 @@ void do_watch(struct connection *conn, s 10.4 10.5 if (strstarts(vec[0], "@")) { 10.6 relative = false; 10.7 + if (strlen(vec[0]) > XENSTORE_REL_PATH_MAX) { 10.8 + send_error(conn, EINVAL); 10.9 + return; 10.10 + } 10.11 /* check if valid event */ 10.12 } else { 10.13 relative = !strstarts(vec[0], "/");
11.1 --- a/tools/xenstore/xs.c Thu Dec 13 09:34:49 2007 -0700 11.2 +++ b/tools/xenstore/xs.c Fri Dec 14 10:12:40 2007 -0700 11.3 @@ -319,6 +319,11 @@ static void *xs_talkv(struct xs_handle * 11.4 for (i = 0; i < num_vecs; i++) 11.5 msg.len += iovec[i].iov_len; 11.6 11.7 + if (msg.len > XENSTORE_PAYLOAD_MAX) { 11.8 + errno = E2BIG; 11.9 + return 0; 11.10 + } 11.11 + 11.12 ignorepipe.sa_handler = SIG_IGN; 11.13 sigemptyset(&ignorepipe.sa_mask); 11.14 ignorepipe.sa_flags = 0;
12.1 --- a/tools/xenstore/xsls.c Thu Dec 13 09:34:49 2007 -0700 12.2 +++ b/tools/xenstore/xsls.c Fri Dec 14 10:12:40 2007 -0700 12.3 @@ -8,7 +8,7 @@ 12.4 #include <sys/ioctl.h> 12.5 #include <termios.h> 12.6 12.7 -#define STRING_MAX PATH_MAX 12.8 +#define STRING_MAX XENSTORE_ABS_PATH_MAX+1024 12.9 static int max_width = 80; 12.10 static int desired_width = 60; 12.11 static int show_whole_path = 0;
13.1 --- a/xen/arch/x86/hvm/hvm.c Thu Dec 13 09:34:49 2007 -0700 13.2 +++ b/xen/arch/x86/hvm/hvm.c Fri Dec 14 10:12:40 2007 -0700 13.3 @@ -1405,6 +1405,25 @@ void hvm_cpuid(unsigned int input, unsig 13.4 } 13.5 } 13.6 13.7 +enum hvm_intblk hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack) 13.8 +{ 13.9 + enum hvm_intblk r; 13.10 + ASSERT(v == current); 13.11 + 13.12 + r = hvm_funcs.interrupt_blocked(v, intack); 13.13 + if ( r != hvm_intblk_none ) 13.14 + return r; 13.15 + 13.16 + if ( intack.source == hvm_intsrc_lapic ) 13.17 + { 13.18 + uint32_t tpr = vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xF0; 13.19 + if ( (tpr >> 4) >= (intack.vector >> 4) ) 13.20 + return hvm_intblk_tpr; 13.21 + } 13.22 + 13.23 + return r; 13.24 +} 13.25 + 13.26 static long hvm_grant_table_op( 13.27 unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count) 13.28 { 13.29 @@ -1425,7 +1444,6 @@ static hvm_hypercall_t *hvm_hypercall32_ 13.30 HYPERCALL(memory_op), 13.31 [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, 13.32 HYPERCALL(xen_version), 13.33 - HYPERCALL(grant_table_op), 13.34 HYPERCALL(event_channel_op), 13.35 HYPERCALL(sched_op), 13.36 HYPERCALL(hvm_op) 13.37 @@ -1478,7 +1496,6 @@ static hvm_hypercall_t *hvm_hypercall64_ 13.38 HYPERCALL(memory_op), 13.39 [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, 13.40 HYPERCALL(xen_version), 13.41 - HYPERCALL(grant_table_op), 13.42 HYPERCALL(event_channel_op), 13.43 HYPERCALL(sched_op), 13.44 HYPERCALL(hvm_op) 13.45 @@ -1488,7 +1505,6 @@ static hvm_hypercall_t *hvm_hypercall32_ 13.46 [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)do_memory_op_compat32, 13.47 [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op, 13.48 HYPERCALL(xen_version), 13.49 - HYPERCALL(grant_table_op), 13.50 HYPERCALL(event_channel_op), 13.51 HYPERCALL(sched_op), 13.52 HYPERCALL(hvm_op)
14.1 --- a/xen/arch/x86/hvm/svm/svm.c Thu Dec 13 09:34:49 2007 -0700 14.2 +++ b/xen/arch/x86/hvm/svm/svm.c Fri Dec 14 10:12:40 2007 -0700 14.3 @@ -443,10 +443,6 @@ static enum hvm_intblk svm_interrupt_blo 14.4 if ( !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) ) 14.5 return hvm_intblk_rflags_ie; 14.6 14.7 - if ( (intack.source == hvm_intsrc_lapic) && 14.8 - ((vmcb->vintr.fields.tpr & 0xf) >= (intack.vector >> 4)) ) 14.9 - return hvm_intblk_tpr; 14.10 - 14.11 return hvm_intblk_none; 14.12 } 14.13 14.14 @@ -522,13 +518,6 @@ static void svm_flush_guest_tlbs(void) 14.15 svm_asid_inc_generation(); 14.16 } 14.17 14.18 -static void svm_update_vtpr(struct vcpu *v, unsigned long value) 14.19 -{ 14.20 - struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; 14.21 - 14.22 - vmcb->vintr.fields.tpr = value & 0x0f; 14.23 -} 14.24 - 14.25 static void svm_sync_vmcb(struct vcpu *v) 14.26 { 14.27 struct arch_svm_struct *arch_svm = &v->arch.hvm_svm; 14.28 @@ -788,6 +777,10 @@ static void svm_do_resume(struct vcpu *v 14.29 svm_asid_init_vcpu(v); 14.30 } 14.31 14.32 + /* Reflect the vlapic's TPR in the hardware vtpr */ 14.33 + v->arch.hvm_svm.vmcb->vintr.fields.tpr = 14.34 + (vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xFF) >> 4; 14.35 + 14.36 hvm_do_resume(v); 14.37 reset_stack_and_jump(svm_asm_do_resume); 14.38 } 14.39 @@ -885,7 +878,6 @@ static struct hvm_function_table svm_fun 14.40 .update_guest_cr = svm_update_guest_cr, 14.41 .update_guest_efer = svm_update_guest_efer, 14.42 .flush_guest_tlbs = svm_flush_guest_tlbs, 14.43 - .update_vtpr = svm_update_vtpr, 14.44 .stts = svm_stts, 14.45 .set_tsc_offset = svm_set_tsc_offset, 14.46 .inject_exception = svm_inject_exception, 14.47 @@ -2212,6 +2204,10 @@ asmlinkage void svm_vmexit_handler(struc 14.48 domain_crash(v->domain); 14.49 break; 14.50 } 14.51 + 14.52 + /* The exit may have updated the TPR: reflect this in the hardware vtpr */ 14.53 + vmcb->vintr.fields.tpr = 14.54 + (vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xFF) >> 4; 14.55 } 14.56 14.57 asmlinkage void svm_trace_vmentry(void)
15.1 --- a/xen/arch/x86/hvm/vlapic.c Thu Dec 13 09:34:49 2007 -0700 15.2 +++ b/xen/arch/x86/hvm/vlapic.c Fri Dec 14 10:12:40 2007 -0700 15.3 @@ -120,14 +120,9 @@ static void vlapic_clear_irr(int vector, 15.4 vlapic_clear_vector(vector, &vlapic->regs->data[APIC_IRR]); 15.5 } 15.6 15.7 -int vlapic_find_highest_irr(struct vlapic *vlapic) 15.8 +static int vlapic_find_highest_irr(struct vlapic *vlapic) 15.9 { 15.10 - int result; 15.11 - 15.12 - result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]); 15.13 - ASSERT((result == -1) || (result >= 16)); 15.14 - 15.15 - return result; 15.16 + return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]); 15.17 } 15.18 15.19 int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig) 15.20 @@ -142,14 +137,9 @@ int vlapic_set_irq(struct vlapic *vlapic 15.21 return ret; 15.22 } 15.23 15.24 -int vlapic_find_highest_isr(struct vlapic *vlapic) 15.25 +static int vlapic_find_highest_isr(struct vlapic *vlapic) 15.26 { 15.27 - int result; 15.28 - 15.29 - result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]); 15.30 - ASSERT((result == -1) || (result >= 16)); 15.31 - 15.32 - return result; 15.33 + return vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]); 15.34 } 15.35 15.36 uint32_t vlapic_get_ppr(struct vlapic *vlapic) 15.37 @@ -454,11 +444,9 @@ static void vlapic_set_tdcr(struct vlapi 15.38 "timer_divisor: %d", vlapic->hw.timer_divisor); 15.39 } 15.40 15.41 -static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset, 15.42 - unsigned int len, unsigned int *result) 15.43 +static void vlapic_read_aligned( 15.44 + struct vlapic *vlapic, unsigned int offset, unsigned int *result) 15.45 { 15.46 - ASSERT((len == 4) && (offset >= 0) && (offset <= APIC_TDCR)); 15.47 - 15.48 switch ( offset ) 15.49 { 15.50 case APIC_PROCPRI: 15.51 @@ -487,15 +475,9 @@ static unsigned long vlapic_read(struct 15.52 if ( offset > APIC_TDCR ) 15.53 return 0; 15.54 15.55 - /* some bugs on kernel cause read this with byte*/ 15.56 - if ( len != 4 ) 15.57 - HVM_DBG_LOG(DBG_LEVEL_VLAPIC, 15.58 - "read with len=0x%lx, should be 4 instead", 15.59 - len); 15.60 - 15.61 alignment = offset & 0x3; 15.62 15.63 - vlapic_read_aligned(vlapic, offset & ~0x3, 4, &tmp); 15.64 + vlapic_read_aligned(vlapic, offset & ~0x3, &tmp); 15.65 switch ( len ) 15.66 { 15.67 case 1: 15.68 @@ -503,12 +485,14 @@ static unsigned long vlapic_read(struct 15.69 break; 15.70 15.71 case 2: 15.72 - ASSERT( alignment != 3 ); 15.73 + if ( alignment == 3 ) 15.74 + goto unaligned_exit_and_crash; 15.75 result = *(unsigned short *)((unsigned char *)&tmp + alignment); 15.76 break; 15.77 15.78 case 4: 15.79 - ASSERT( alignment == 0 ); 15.80 + if ( alignment != 0 ) 15.81 + goto unaligned_exit_and_crash; 15.82 result = *(unsigned int *)((unsigned char *)&tmp + alignment); 15.83 break; 15.84 15.85 @@ -523,6 +507,9 @@ static unsigned long vlapic_read(struct 15.86 15.87 return result; 15.88 15.89 + unaligned_exit_and_crash: 15.90 + gdprintk(XENLOG_ERR, "Unaligned LAPIC read len=0x%lx at offset=0x%x.\n", 15.91 + len, offset); 15.92 exit_and_crash: 15.93 domain_crash(v->domain); 15.94 return 0; 15.95 @@ -593,7 +580,6 @@ static void vlapic_write(struct vcpu *v, 15.96 { 15.97 case APIC_TASKPRI: 15.98 vlapic_set_reg(vlapic, APIC_TASKPRI, val & 0xff); 15.99 - hvm_update_vtpr(v, (val >> 4) & 0x0f); 15.100 break; 15.101 15.102 case APIC_EOI:
16.1 --- a/xen/arch/x86/hvm/vmx/vmx.c Thu Dec 13 09:34:49 2007 -0700 16.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c Fri Dec 14 10:12:40 2007 -0700 16.3 @@ -1011,13 +1011,6 @@ static enum hvm_intblk vmx_interrupt_blo 16.4 if ( !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) ) 16.5 return hvm_intblk_rflags_ie; 16.6 16.7 - if ( intack.source == hvm_intsrc_lapic ) 16.8 - { 16.9 - uint32_t tpr = vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xF0; 16.10 - if ( (tpr >> 4) >= (intack.vector >> 4) ) 16.11 - return hvm_intblk_tpr; 16.12 - } 16.13 - 16.14 return hvm_intblk_none; 16.15 } 16.16 16.17 @@ -1120,11 +1113,6 @@ static void vmx_inject_exception( 16.18 } 16.19 } 16.20 16.21 -static void vmx_update_vtpr(struct vcpu *v, unsigned long value) 16.22 -{ 16.23 - /* VMX doesn't have a V_TPR field */ 16.24 -} 16.25 - 16.26 static int vmx_event_pending(struct vcpu *v) 16.27 { 16.28 ASSERT(v == current); 16.29 @@ -1148,7 +1136,6 @@ static struct hvm_function_table vmx_fun 16.30 .update_guest_cr = vmx_update_guest_cr, 16.31 .update_guest_efer = vmx_update_guest_efer, 16.32 .flush_guest_tlbs = vmx_flush_guest_tlbs, 16.33 - .update_vtpr = vmx_update_vtpr, 16.34 .stts = vmx_stts, 16.35 .set_tsc_offset = vmx_set_tsc_offset, 16.36 .inject_exception = vmx_inject_exception,
17.1 --- a/xen/arch/x86/oprofile/op_model_ppro.c Thu Dec 13 09:34:49 2007 -0700 17.2 +++ b/xen/arch/x86/oprofile/op_model_ppro.c Fri Dec 14 10:12:40 2007 -0700 17.3 @@ -104,6 +104,8 @@ static int ppro_check_ctrs(unsigned int 17.4 int mode = xenoprofile_get_mode(current, regs); 17.5 17.6 for (i = 0 ; i < NUM_COUNTERS; ++i) { 17.7 + if (!reset_value[i]) 17.8 + continue; 17.9 CTR_READ(low, high, msrs, i); 17.10 if (CTR_OVERFLOWED(low)) { 17.11 xenoprof_log_event(current, regs, eip, mode, i); 17.12 @@ -123,18 +125,30 @@ static int ppro_check_ctrs(unsigned int 17.13 static void ppro_start(struct op_msrs const * const msrs) 17.14 { 17.15 unsigned int low,high; 17.16 - CTRL_READ(low, high, msrs, 0); 17.17 - CTRL_SET_ACTIVE(low); 17.18 - CTRL_WRITE(low, high, msrs, 0); 17.19 + int i; 17.20 + 17.21 + for (i = 0; i < NUM_COUNTERS; ++i) { 17.22 + if (reset_value[i]) { 17.23 + CTRL_READ(low, high, msrs, i); 17.24 + CTRL_SET_ACTIVE(low); 17.25 + CTRL_WRITE(low, high, msrs, i); 17.26 + } 17.27 + } 17.28 } 17.29 17.30 17.31 static void ppro_stop(struct op_msrs const * const msrs) 17.32 { 17.33 unsigned int low,high; 17.34 - CTRL_READ(low, high, msrs, 0); 17.35 - CTRL_SET_INACTIVE(low); 17.36 - CTRL_WRITE(low, high, msrs, 0); 17.37 + int i; 17.38 + 17.39 + for (i = 0; i < NUM_COUNTERS; ++i) { 17.40 + if (!reset_value[i]) 17.41 + continue; 17.42 + CTRL_READ(low, high, msrs, i); 17.43 + CTRL_SET_INACTIVE(low); 17.44 + CTRL_WRITE(low, high, msrs, i); 17.45 + } 17.46 } 17.47 17.48
18.1 --- a/xen/arch/x86/traps.c Thu Dec 13 09:34:49 2007 -0700 18.2 +++ b/xen/arch/x86/traps.c Fri Dec 14 10:12:40 2007 -0700 18.3 @@ -1878,7 +1878,7 @@ static int emulate_privileged_op(struct 18.4 eax = regs->eax; 18.5 edx = regs->edx; 18.6 res = ((u64)edx << 32) | eax; 18.7 - switch ( regs->ecx ) 18.8 + switch ( (u32)regs->ecx ) 18.9 { 18.10 #ifdef CONFIG_X86_64 18.11 case MSR_FS_BASE: 18.12 @@ -1916,15 +1916,19 @@ static int emulate_privileged_op(struct 18.13 case MSR_K8_PSTATE5: 18.14 case MSR_K8_PSTATE6: 18.15 case MSR_K8_PSTATE7: 18.16 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 18.17 - (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || 18.18 - wrmsr_safe(regs->ecx, eax, edx) ) 18.19 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) 18.20 + goto fail; 18.21 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 18.22 + break; 18.23 + if ( wrmsr_safe(regs->ecx, eax, edx) != 0 ) 18.24 goto fail; 18.25 break; 18.26 case MSR_IA32_PERF_CTL: 18.27 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 18.28 - (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) || 18.29 - wrmsr_safe(regs->ecx, eax, edx) ) 18.30 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ) 18.31 + goto fail; 18.32 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 18.33 + break; 18.34 + if ( wrmsr_safe(regs->ecx, eax, edx) != 0 ) 18.35 goto fail; 18.36 break; 18.37 default: 18.38 @@ -1944,7 +1948,7 @@ static int emulate_privileged_op(struct 18.39 break; 18.40 18.41 case 0x32: /* RDMSR */ 18.42 - switch ( regs->ecx ) 18.43 + switch ( (u32)regs->ecx ) 18.44 { 18.45 #ifdef CONFIG_X86_64 18.46 case MSR_FS_BASE: 18.47 @@ -1979,9 +1983,14 @@ static int emulate_privileged_op(struct 18.48 case MSR_K8_PSTATE5: 18.49 case MSR_K8_PSTATE6: 18.50 case MSR_K8_PSTATE7: 18.51 - if ( (cpufreq_controller != FREQCTL_dom0_kernel) || 18.52 - (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) || 18.53 - rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) 18.54 + if ( boot_cpu_data.x86_vendor != X86_VENDOR_AMD ) 18.55 + goto fail; 18.56 + if ( cpufreq_controller != FREQCTL_dom0_kernel ) 18.57 + { 18.58 + regs->eax = regs->edx = 0; 18.59 + break; 18.60 + } 18.61 + if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) != 0 ) 18.62 goto fail; 18.63 break; 18.64 case MSR_EFER:
19.1 --- a/xen/common/xenoprof.c Thu Dec 13 09:34:49 2007 -0700 19.2 +++ b/xen/common/xenoprof.c Fri Dec 14 10:12:40 2007 -0700 19.3 @@ -12,6 +12,7 @@ 19.4 #ifndef COMPAT 19.5 #include <xen/guest_access.h> 19.6 #include <xen/sched.h> 19.7 +#include <xen/event.h> 19.8 #include <public/xenoprof.h> 19.9 #include <xen/paging.h> 19.10 #include <xsm/xsm.h> 19.11 @@ -747,14 +748,30 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN 19.12 break; 19.13 19.14 case XENOPROF_stop: 19.15 + { 19.16 + struct domain *d; 19.17 + struct vcpu *v; 19.18 + int i; 19.19 + 19.20 if ( xenoprof_state != XENOPROF_PROFILING ) 19.21 { 19.22 ret = -EPERM; 19.23 break; 19.24 } 19.25 xenoprof_arch_stop(); 19.26 + 19.27 + /* Flush remaining samples. */ 19.28 + for ( i = 0; i < adomains; i++ ) 19.29 + { 19.30 + if ( !active_ready[i] ) 19.31 + continue; 19.32 + d = active_domains[i]; 19.33 + for_each_vcpu(d, v) 19.34 + send_guest_vcpu_virq(v, VIRQ_XENOPROF); 19.35 + } 19.36 xenoprof_state = XENOPROF_READY; 19.37 break; 19.38 + } 19.39 19.40 case XENOPROF_disable_virq: 19.41 {
20.1 --- a/xen/include/asm-x86/hvm/hvm.h Thu Dec 13 09:34:49 2007 -0700 20.2 +++ b/xen/include/asm-x86/hvm/hvm.h Fri Dec 14 10:12:40 2007 -0700 20.3 @@ -106,11 +106,6 @@ struct hvm_function_table { 20.4 void (*flush_guest_tlbs)(void); 20.5 20.6 /* 20.7 - * Reflect the virtual APIC's value in the guest's V_TPR register 20.8 - */ 20.9 - void (*update_vtpr)(struct vcpu *v, unsigned long value); 20.10 - 20.11 - /* 20.12 * Update specifics of the guest state: 20.13 * 1) TS bit in guest cr0 20.14 * 2) TSC offset in guest 20.15 @@ -161,12 +156,8 @@ u64 hvm_get_guest_tsc(struct vcpu *v); 20.16 #define hvm_long_mode_enabled(v) (v,0) 20.17 #endif 20.18 20.19 -static inline enum hvm_intblk 20.20 -hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack) 20.21 -{ 20.22 - ASSERT(v == current); 20.23 - return hvm_funcs.interrupt_blocked(v, intack); 20.24 -} 20.25 +enum hvm_intblk 20.26 +hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack); 20.27 20.28 static inline int 20.29 hvm_guest_x86_mode(struct vcpu *v) 20.30 @@ -184,12 +175,6 @@ hvm_update_host_cr3(struct vcpu *v) 20.31 hvm_funcs.update_host_cr3(v); 20.32 } 20.33 20.34 -static inline void 20.35 -hvm_update_vtpr(struct vcpu *v, unsigned long value) 20.36 -{ 20.37 - hvm_funcs.update_vtpr(v, value); 20.38 -} 20.39 - 20.40 static inline void hvm_update_guest_cr(struct vcpu *v, unsigned int cr) 20.41 { 20.42 hvm_funcs.update_guest_cr(v, cr);
21.1 --- a/xen/include/asm-x86/hvm/vlapic.h Thu Dec 13 09:34:49 2007 -0700 21.2 +++ b/xen/include/asm-x86/hvm/vlapic.h Fri Dec 14 10:12:40 2007 -0700 21.3 @@ -73,8 +73,6 @@ static inline void vlapic_set_reg( 21.4 21.5 int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig); 21.6 21.7 -int vlapic_find_highest_irr(struct vlapic *vlapic); 21.8 - 21.9 int vlapic_has_pending_irq(struct vcpu *v); 21.10 int vlapic_ack_pending_irq(struct vcpu *v, int vector); 21.11
22.1 --- a/xen/include/public/io/xs_wire.h Thu Dec 13 09:34:49 2007 -0700 22.2 +++ b/xen/include/public/io/xs_wire.h Fri Dec 14 10:12:40 2007 -0700 22.3 @@ -108,6 +108,13 @@ struct xenstore_domain_interface { 22.4 XENSTORE_RING_IDX rsp_cons, rsp_prod; 22.5 }; 22.6 22.7 +/* Violating this is very bad. See docs/misc/xenstore.txt. */ 22.8 +#define XENSTORE_PAYLOAD_MAX 4096 22.9 + 22.10 +/* Violating these just gets you an error back */ 22.11 +#define XENSTORE_ABS_PATH_MAX 3072 22.12 +#define XENSTORE_REL_PATH_MAX 2048 22.13 + 22.14 #endif /* _XS_WIRE_H */ 22.15 22.16 /*