Mailing List Archive

1 2  View All
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1423, 2005/05/16 21:21:53+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



blkback.c | 381 ++++++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 263 insertions(+), 118 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c 2005-05-16 17:04:12 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c 2005-05-16 17:04:12 -04:00
@@ -8,9 +8,14 @@
* arch/xen/drivers/blkif/frontend
*
* Copyright (c) 2003-2004, Keir Fraser & Steve Hand
+ * Copyright (c) 2005, Christopher Clark
*/

#include "common.h"
+#include <asm-xen/evtchn.h>
+#ifdef CONFIG_XEN_BLKDEV_GRANT
+#include <asm-xen/xen-public/grant_table.h>
+#endif

/*
* These are rather arbitrary. They are fairly large because adjacent requests
@@ -25,13 +30,11 @@
#define BATCH_PER_DOMAIN 16

static unsigned long mmap_vstart;
-#define MMAP_PAGES_PER_REQUEST \
- (BLKIF_MAX_SEGMENTS_PER_REQUEST + 1)
-#define MMAP_PAGES \
- (MAX_PENDING_REQS * MMAP_PAGES_PER_REQUEST)
-#define MMAP_VADDR(_req,_seg) \
- (mmap_vstart + \
- ((_req) * MMAP_PAGES_PER_REQUEST * PAGE_SIZE) + \
+#define MMAP_PAGES \
+ (MAX_PENDING_REQS * BLKIF_MAX_SEGMENTS_PER_REQUEST)
+#define MMAP_VADDR(_req,_seg) \
+ (mmap_vstart + \
+ ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE) + \
((_seg) * PAGE_SIZE))

/*
@@ -81,6 +84,29 @@
}
#endif

+#ifdef CONFIG_XEN_BLKDEV_GRANT
+/* When using grant tables to map a frame for device access then the
+ * handle returned must be used to unmap the frame. This is needed to
+ * drop the ref count on the frame.
+ */
+static u16 pending_grant_handles[MMAP_PAGES];
+#define pending_handle(_idx, _i) \
+ (pending_grant_handles[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
+#define BLKBACK_INVALID_HANDLE (0xFFFF)
+#endif
+
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+/*
+ * If the tap driver is used, we may get pages belonging to either the tap
+ * or (more likely) the real frontend. The backend must specify which domain
+ * a given page belongs to in update_va_mapping though. For the moment,
+ * the tap rewrites the ID field of the request to contain the request index
+ * and the id of the real front end domain.
+ */
+#define BLKTAP_COOKIE 0xbeadfeed
+static inline domid_t ID_TO_DOM(unsigned long id) { return (id >> 16); }
+#endif
+
static int do_block_io_op(blkif_t *blkif, int max_to_do);
static void dispatch_probe(blkif_t *blkif, blkif_request_t *req);
static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req);
@@ -89,20 +115,42 @@

static void fast_flush_area(int idx, int nr_pages)
{
- multicall_entry_t mcl[MMAP_PAGES_PER_REQUEST];
+#ifdef CONFIG_XEN_BLKDEV_GRANT
+ gnttab_op_t aop[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+ unsigned int i, invcount = 0;
+ u16 handle;
+
+ for ( i = 0; i < nr_pages; i++ )
+ {
+ if ( BLKBACK_INVALID_HANDLE != ( handle = pending_handle(idx, i) ) )
+ {
+ aop[i].u.unmap_grant_ref.host_virt_addr = MMAP_VADDR(idx, i);
+ aop[i].u.unmap_grant_ref.dev_bus_addr = 0;
+ aop[i].u.unmap_grant_ref.handle = handle;
+ pending_handle(idx, i) = BLKBACK_INVALID_HANDLE;
+ invcount++;
+ }
+ }
+ if ( unlikely(HYPERVISOR_grant_table_op(
+ GNTTABOP_unmap_grant_ref, aop, invcount)))
+ BUG();
+#else
+
+ multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
int i;

for ( i = 0; i < nr_pages; i++ )
{
mcl[i].op = __HYPERVISOR_update_va_mapping;
- mcl[i].args[0] = MMAP_VADDR(idx, i) >> PAGE_SHIFT;
+ mcl[i].args[0] = MMAP_VADDR(idx, i);
mcl[i].args[1] = 0;
mcl[i].args[2] = 0;
}

- mcl[nr_pages-1].args[2] = UVMF_FLUSH_TLB;
+ mcl[nr_pages-1].args[2] = UVMF_TLB_FLUSH|UVMF_ALL;
if ( unlikely(HYPERVISOR_multicall(mcl, nr_pages) != 0) )
BUG();
+#endif
}


@@ -281,17 +329,16 @@

static int do_block_io_op(blkif_t *blkif, int max_to_do)
{
- blkif_ring_t *blk_ring = blkif->blk_ring_base;
+ blkif_back_ring_t *blk_ring = &blkif->blk_ring;
blkif_request_t *req;
- BLKIF_RING_IDX i, rp;
+ RING_IDX i, rp;
int more_to_do = 0;

- rp = blk_ring->req_prod;
+ rp = blk_ring->sring->req_prod;
rmb(); /* Ensure we see queued requests up to 'rp'. */

- /* Take items off the comms ring, taking care not to overflow. */
- for ( i = blkif->blk_req_cons;
- (i != rp) && ((i-blkif->blk_resp_prod) != BLKIF_RING_SIZE);
+ for ( i = blk_ring->req_cons;
+ (i != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, i);
i++ )
{
if ( (max_to_do-- == 0) || (NR_PENDING_REQS == MAX_PENDING_REQS) )
@@ -300,7 +347,7 @@
break;
}

- req = &blk_ring->ring[MASK_BLKIF_IDX(i)].req;
+ req = RING_GET_REQUEST(blk_ring, i);
switch ( req->operation )
{
case BLKIF_OP_READ:
@@ -314,14 +361,13 @@

default:
DPRINTK("error: unknown block io operation [%d]\n",
- blk_ring->ring[i].req.operation);
- make_response(blkif, blk_ring->ring[i].req.id,
- blk_ring->ring[i].req.operation, BLKIF_RSP_ERROR);
+ req->operation);
+ make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR);
break;
}
}

- blkif->blk_req_cons = i;
+ blk_ring->req_cons = i;
return more_to_do;
}

@@ -339,12 +385,50 @@
(blkif_last_sect(req->frame_and_sects[0]) != 7) )
goto out;

+#ifdef CONFIG_XEN_BLKDEV_GRANT
+ {
+ gnttab_op_t op;
+
+ op.u.map_grant_ref.host_virt_addr = MMAP_VADDR(pending_idx, 0);
+ op.u.map_grant_ref.flags = GNTMAP_host_map;
+ op.u.map_grant_ref.ref = blkif_gref_from_fas(req->frame_and_sects[0]);
+ op.u.map_grant_ref.dom = blkif->domid;
+
+ if ( unlikely(HYPERVISOR_grant_table_op(
+ GNTTABOP_map_grant_ref, &op, 1)))
+ BUG();
+
+ if ( op.u.map_grant_ref.handle < 0 )
+ goto out;
+
+ pending_handle(pending_idx, 0) = op.u.map_grant_ref.handle;
+ }
+#else /* else CONFIG_XEN_BLKDEV_GRANT */
+
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+ /* Grab the real frontend out of the probe message. */
+ if (req->frame_and_sects[1] == BLKTAP_COOKIE)
+ blkif->is_blktap = 1;
+#endif
+
+
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
if ( HYPERVISOR_update_va_mapping_otherdomain(
- MMAP_VADDR(pending_idx, 0) >> PAGE_SHIFT,
+ MMAP_VADDR(pending_idx, 0),
(pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
- 0, blkif->domid) )
+ 0, (blkif->is_blktap ? ID_TO_DOM(req->id) : blkif->domid) ) )
+
goto out;
-
+#else
+ if ( HYPERVISOR_update_va_mapping_otherdomain(
+ MMAP_VADDR(pending_idx, 0),
+ (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
+ 0, blkif->domid) )
+
+ goto out;
+#endif
+#endif /* endif CONFIG_XEN_BLKDEV_GRANT */
+
rsp = vbd_probe(blkif, (vdisk_t *)MMAP_VADDR(pending_idx, 0),
PAGE_SIZE / sizeof(vdisk_t));

@@ -357,113 +441,152 @@
{
extern void ll_rw_block(int rw, int nr, struct buffer_head * bhs[]);
int operation = (req->operation == BLKIF_OP_WRITE) ? WRITE : READ;
- short nr_sects;
- unsigned long buffer, fas;
- int i, tot_sects, pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
+ unsigned long fas = 0;
+ int i, pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
pending_req_t *pending_req;
- unsigned long remap_prot;
- multicall_entry_t mcl[MMAP_PAGES_PER_REQUEST];
-
- /* We map virtual scatter/gather segments to physical segments. */
- int new_segs, nr_psegs = 0;
- phys_seg_t phys_seg[BLKIF_MAX_SEGMENTS_PER_REQUEST + 1];
+#ifdef CONFIG_XEN_BLKDEV_GRANT
+ gnttab_op_t aop[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+#else
+ unsigned long remap_prot;
+ multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+#endif
+ struct phys_req preq;
+ struct {
+ unsigned long buf; unsigned int nsec;
+ } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+ unsigned int nseg;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+ struct buffer_head *bh;
+#else
+ struct bio *bio = NULL, *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST];
+ int nbio = 0;
+ request_queue_t *q;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1436, 2005/05/17 19:04:24+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



network | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/tools/examples/network b/tools/examples/network
--- a/tools/examples/network 2005-05-17 15:02:14 -04:00
+++ b/tools/examples/network 2005-05-17 15:02:14 -04:00
@@ -53,7 +53,7 @@
netdev=${netdev:-eth0}
antispoof=${antispoof:-yes}

-echo "network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof"
+echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2

# Usage: transfer_addrs src dst
# Copy all IP addresses (including aliases) from device $src to device $dst.
@@ -236,7 +236,7 @@
;;

*)
- echo 'Unknown command: ' ${OP}
- echo 'Valid commands are: start, stop, status'
+ echo 'Unknown command: ' ${OP} >&2
+ echo 'Valid commands are: start, stop, status' >&2
exit 1
esac

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1442, 2005/05/18 08:57:40+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



network | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/tools/examples/network b/tools/examples/network
--- a/tools/examples/network 2005-05-18 04:09:30 -04:00
+++ b/tools/examples/network 2005-05-18 04:09:30 -04:00
@@ -53,7 +53,7 @@
netdev=${netdev:-eth0}
antispoof=${antispoof:-yes}

-echo "network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof"
+echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2

# Usage: transfer_addrs src dst
# Copy all IP addresses (including aliases) from device $src to device $dst.
@@ -233,7 +233,7 @@
;;

*)
- echo 'Unknown command: ' ${OP}
- echo 'Valid commands are: start, stop, status'
+ echo 'Unknown command: ' ${OP} >&2
+ echo 'Valid commands are: start, stop, status' >&2
exit 1
esac

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1465, 2005/05/19 15:04:05+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



0 files changed



_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1496, 2005/05/21 00:13:11+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



Makefile | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile 2005-05-20 20:04:22 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/Makefile 2005-05-20 20:04:22 -04:00
@@ -10,9 +10,9 @@

obj-y := process.o signal.o entry.o traps.o \
time.o ioport.o ldt.o setup.o \
- pci-dma.o i386_ksyms.o
+ pci-dma.o i386_ksyms.o irq.o

-c-obj-y := semaphore.o irq.o vm86.o \
+c-obj-y := semaphore.o vm86.o \
ptrace.o sys_i386.o \
i387.o dmi_scan.o bootflag.o \
doublefault.o quirks.o
@@ -20,18 +20,19 @@

obj-y += cpu/
obj-y += timers/
-c-obj-$(CONFIG_ACPI_BOOT) += acpi/
+obj-$(CONFIG_ACPI_BOOT) += acpi/
#c-obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o
c-obj-$(CONFIG_MCA) += mca.o
c-obj-$(CONFIG_X86_MSR) += msr.o
c-obj-$(CONFIG_X86_CPUID) += cpuid.o
obj-$(CONFIG_MICROCODE) += microcode.o
c-obj-$(CONFIG_APM) += apm.o
-c-obj-$(CONFIG_X86_SMP) += smp.o smpboot.o
-c-obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
-c-obj-$(CONFIG_X86_MPPARSE) += mpparse.o
-c-obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o
-c-obj-$(CONFIG_X86_IO_APIC) += io_apic.o
+obj-$(CONFIG_X86_SMP) += smp.o smpboot.o
+#obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o
+obj-$(CONFIG_X86_MPPARSE) += mpparse.o
+obj-$(CONFIG_X86_LOCAL_APIC) += apic.o
+c-obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o
+obj-$(CONFIG_X86_IO_APIC) += io_apic.o
c-obj-$(CONFIG_X86_NUMAQ) += numaq.o
c-obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
c-obj-$(CONFIG_MODULES) += module.o

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk [ In reply to ]
ChangeSet 1.1497, 2005/05/21 00:17:26+01:00, kaf24@firebug.cl.cam.ac.uk

Merge firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk



init.c | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/init.c b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/init.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/mm/init.c 2005-05-20 20:04:38 -04:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/mm/init.c 2005-05-20 20:04:38 -04:00
@@ -192,7 +192,6 @@
}
pte_ofs = 0;
}
- flush_page_update_queue();
}
pmd_idx = 0;
}
@@ -356,12 +355,13 @@
*/
memcpy(pgd_base, old_pgd, PTRS_PER_PGD_NO_HV*sizeof(pgd_t));
make_page_readonly(pgd_base);
- queue_pgd_pin(__pa(pgd_base));
+ xen_pgd_pin(__pa(pgd_base));
load_cr3(pgd_base);
- queue_pgd_unpin(__pa(old_pgd));
+ xen_pgd_unpin(__pa(old_pgd));
make_page_writable(old_pgd);
__flush_tlb_all();
free_bootmem(__pa(old_pgd), PAGE_SIZE);
+ init_mm.context.pinned = 1;

kernel_physical_mapping_init(pgd_base);
remap_numa_kva();
@@ -563,8 +563,7 @@
zone_sizes_init();

/* Switch to the real shared_info page, and clear the dummy page. */
- flush_page_update_queue();
- set_fixmap_ma(FIX_SHARED_INFO, xen_start_info.shared_info);
+ set_fixmap(FIX_SHARED_INFO, xen_start_info.shared_info);
HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
memset(empty_zero_page, 0, sizeof(empty_zero_page));

@@ -572,10 +571,11 @@
/* Setup mapping of lower 1st MB */
for (i = 0; i < NR_FIX_ISAMAPS; i++)
if (xen_start_info.flags & SIF_PRIVILEGED)
- set_fixmap_ma(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
+ set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
else
- set_fixmap_ma_ro(FIX_ISAMAP_BEGIN - i,
- virt_to_machine(empty_zero_page));
+ __set_fixmap(FIX_ISAMAP_BEGIN - i,
+ virt_to_machine(empty_zero_page),
+ PAGE_KERNEL_RO);
#endif
}

@@ -715,18 +715,9 @@

kmem_cache_t *pgd_cache;
kmem_cache_t *pmd_cache;
-kmem_cache_t *pte_cache;

void __init pgtable_cache_init(void)
{
- pte_cache = kmem_cache_create("pte",
- PTRS_PER_PTE*sizeof(pte_t),
- PTRS_PER_PTE*sizeof(pte_t),
- 0,
- pte_ctor,
- pte_dtor);
- if (!pte_cache)
- panic("pgtable_cache_init(): Cannot create pte cache");
if (PTRS_PER_PMD > 1) {
pmd_cache = kmem_cache_create("pmd",
PTRS_PER_PMD*sizeof(pmd_t),

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog

1 2  View All