[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Define new notify_remote_via_irq() interface which is a
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 8c23b56f39540f63eeebb1ffc667c8ac0a264211 # Parent 559ad1abb3d502079ff5bbd39e2979f0a637549e Define new notify_remote_via_irq() interface which is a safe version for drivers to use that is aware of save/restore. Post-restore notifications are silently dropped, in the expectation that xenbus will eventually get round to telling the driver it needs to reconnect. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/arch/xen/i386/kernel/smp.c --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smp.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smp.c Thu Sep 29 14:49:54 2005 @@ -133,7 +133,7 @@ { int evtchn = per_cpu(ipi_to_evtchn, cpu)[vector]; BUG_ON(evtchn < 0); - notify_via_evtchn(evtchn); + notify_remote_via_evtchn(evtchn); } void __send_IPI_shortcut(unsigned int shortcut, int vector) diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Thu Sep 29 14:49:54 2005 @@ -622,6 +622,14 @@ synch_set_bit(evtchn, &s->evtchn_pending[0]); } +void notify_remote_via_irq(int irq) +{ + int evtchn = irq_to_evtchn[irq]; + + if (VALID_EVTCHN(evtchn)) + notify_remote_via_evtchn(evtchn); +} + void irq_resume(void) { evtchn_op_t op; diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c Thu Sep 29 14:49:54 2005 @@ -33,7 +33,7 @@ { int evtchn = per_cpu(ipi_to_evtchn, cpu)[vector]; BUG_ON(evtchn < 0); - notify_via_evtchn(evtchn); + notify_remote_via_evtchn(evtchn); } void xen_send_IPI_shortcut(unsigned int shortcut, int vector, unsigned int dest) diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c Thu Sep 29 14:49:54 2005 @@ -481,7 +481,7 @@ spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); /* Kick the relevant domain. */ - notify_via_evtchn(blkif->evtchn); + notify_remote_via_irq(blkif->irq); } void blkif_deschedule(blkif_t *blkif) diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Thu Sep 29 14:49:54 2005 @@ -84,7 +84,7 @@ static inline void flush_requests(struct blkfront_info *info) { RING_PUSH_REQUESTS(&info->ring); - notify_via_evtchn(info->evtchn); + notify_remote_via_irq(info->irq); } static void kick_pending_request_queues(struct blkfront_info *info) diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c Thu Sep 29 14:49:54 2005 @@ -842,7 +842,7 @@ spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); /* Kick the relevant domain. */ - notify_via_evtchn(blkif->evtchn); + notify_remote_via_irq(blkif->irq); } static struct miscdevice blktap_miscdev = { diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c --- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c Thu Sep 29 14:49:54 2005 @@ -46,7 +46,8 @@ /* don't block - write as much as possible and return */ -static int __xencons_ring_send(struct ring_head *ring, const char *data, unsigned len) +static int __xencons_ring_send( + struct ring_head *ring, const char *data, unsigned len) { int copied = 0; @@ -63,13 +64,9 @@ int xencons_ring_send(const char *data, unsigned len) { - struct ring_head *out = outring(); - int sent = 0; - - sent = __xencons_ring_send(out, data, len); - notify_via_evtchn(xen_start_info->console_evtchn); + int sent = __xencons_ring_send(outring(), data, len); + notify_remote_via_irq(xencons_irq); return sent; - } diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/netback/netback.c --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Sep 29 14:49:54 2005 @@ -42,7 +42,7 @@ static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE]; static gnttab_transfer_t grant_rx_op[MAX_PENDING_REQS]; -static unsigned char rx_notify[NR_EVENT_CHANNELS]; +static unsigned char rx_notify[NR_IRQS]; /* Don't currently gate addition of an interface to the tx scheduling list. */ #define tx_work_exists(_if) (1) @@ -209,7 +209,7 @@ { netif_t *netif = NULL; s8 status; - u16 size, id, evtchn; + u16 size, id, irq; multicall_entry_t *mcl; mmu_update_t *mmu; gnttab_transfer_t *gop; @@ -320,16 +320,16 @@ gop->status, netif->domid); /* XXX SMH: should free 'old_mfn' here */ status = NETIF_RSP_ERROR; - } - evtchn = netif->evtchn; + } + irq = netif->irq; id = netif->rx->ring[ MASK_NETIF_RX_IDX(netif->rx_resp_prod)].req.id; if (make_rx_response(netif, id, status, (unsigned long)skb->data & ~PAGE_MASK, size, skb->proto_csum_valid) && - (rx_notify[evtchn] == 0)) { - rx_notify[evtchn] = 1; - notify_list[notify_nr++] = evtchn; + (rx_notify[irq] == 0)) { + rx_notify[irq] = 1; + notify_list[notify_nr++] = irq; } netif_put(netif); @@ -339,9 +339,9 @@ } while (notify_nr != 0) { - evtchn = notify_list[--notify_nr]; - rx_notify[evtchn] = 0; - notify_via_evtchn(evtchn); + irq = notify_list[--notify_nr]; + rx_notify[irq] = 0; + notify_remote_via_irq(irq); } /* More work to do? */ @@ -717,7 +717,7 @@ mb(); /* Update producer before checking event threshold. */ if (i == netif->tx->event) - notify_via_evtchn(netif->evtchn); + notify_remote_via_irq(netif->irq); } static int make_rx_response(netif_t *netif, diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Thu Sep 29 14:49:54 2005 @@ -457,7 +457,7 @@ /* Only notify Xen if we really have to. */ mb(); if (np->tx->TX_TEST_IDX == i) - notify_via_evtchn(np->evtchn); + notify_remote_via_irq(np->irq); return 0; @@ -776,7 +776,7 @@ */ np->backend_state = BEST_CONNECTED; wmb(); - notify_via_evtchn(np->evtchn); + notify_remote_via_irq(np->irq); network_tx_buf_gc(dev); if (np->user_state == UST_OPEN) diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Thu Sep 29 14:49:54 2005 @@ -308,7 +308,7 @@ rc = offset; DPRINTK("Notifying frontend via event channel %d\n", tpmif->evtchn); - notify_via_evtchn(tpmif->evtchn); + notify_remote_via_irq(tpmif->irq); return rc; } diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Thu Sep 29 14:49:54 2005 @@ -682,7 +682,7 @@ DPRINTK("Notifying backend via event channel %d\n", tp->evtchn); - notify_via_evtchn(tp->evtchn); + notify_remote_via_irq(tp->irq); spin_unlock_irq(&tp->tx_lock); return offset; diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Thu Sep 29 14:49:54 2005 @@ -147,7 +147,7 @@ data += avail; len -= avail; update_output_chunk(out, avail); - notify_via_evtchn(xen_start_info->store_evtchn); + notify_remote_via_irq(xenbus_irq); } while (len != 0); return 0; @@ -192,7 +192,7 @@ pr_debug("Finished read of %i bytes (%i to go)\n", avail, len); /* If it was full, tell them we've taken some. */ if (was_full) - notify_via_evtchn(xen_start_info->store_evtchn); + notify_remote_via_irq(xenbus_irq); } /* If we left something, wake watch thread to deal with it. */ diff -r 559ad1abb3d5 -r 8c23b56f3954 linux-2.6-xen-sparse/include/asm-xen/evtchn.h --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Thu Sep 29 14:14:03 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Thu Sep 29 14:49:54 2005 @@ -75,6 +75,12 @@ void *dev_id); extern void unbind_evtchn_from_irqhandler(unsigned int irq, void *dev_id); +/* + * Unlike notify_remote_via_evtchn(), this is safe to use across + * save/restore. Notifications on a broken connection are silently dropped. + */ +void notify_remote_via_irq(int irq); + extern void irq_resume(void); /* Entry point for notifications into Linux subsystems. */ @@ -115,12 +121,12 @@ synch_clear_bit(port, &s->evtchn_pending[0]); } -static inline int notify_via_evtchn(int port) +static inline void notify_remote_via_evtchn(int port) { evtchn_op_t op; op.cmd = EVTCHNOP_send; op.u.send.local_port = port; - return HYPERVISOR_event_channel_op(&op); + (void)HYPERVISOR_event_channel_op(&op); } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |