Skip to contentSkip to conversation

Simplify the event channel scanning

PATCH In review Stefan Berger 2 participants 2 messages Feb 27, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Simplify the event channel scanning

This patch simplifies the scanning of a domain's event channels considering that an 'ECS_UNBOUND' event channel is not connected and can be skipped.

xen/acm/acm_simple_type_enforcement_hooks.c +2 -16
diff -r 1c5e6239a8d0 xen/acm/acm_simple_type_enforcement_hooks.c
@@ -193,28 +193,14 @@ ste_init_state(struct acm_ste_policy_buf
         /* a) check for event channel conflicts */
         for (port=0; port < NR_EVTCHN_BUCKETS; port++) {
             spin_lock(&d->evtchn_lock);
-            if (d->evtchn[port] == NULL) {
+            if (d->evtchn[port] == NULL ||
+                d->evtchn[port]->state == ECS_UNBOUND) {
                 spin_unlock(&d->evtchn_lock);
                 continue;
             }
             if (d->evtchn[port]->state == ECS_INTERDOMAIN) {
                 rdom = d->evtchn[port]->u.interdomain.remote_dom;
                 rdomid = rdom->domain_id;
-                /* rdom now has remote domain */
-                ste_rssid = GET_SSIDP(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY, 
-                                      (struct acm_ssid_domain *)(rdom->ssid));
-                ste_rssidref = ste_rssid->ste_ssidref;
-            } else if (d->evtchn[port]->state == ECS_UNBOUND) {
-                rdomid = d->evtchn[port]->u.unbound.remote_domid;
-                if ((rdom = get_domain_by_id(rdomid)) == NULL) {
-                    printk("%s: Error finding domain to id %x!\n", __func__, rdomid);
-                    goto out;
-                }
-                /* rdom now has remote domain */
-                ste_rssid = GET_SSIDP(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY, 
-                                      (struct acm_ssid_domain *)(rdom->ssid));
-                ste_rssidref = ste_rssid->ste_ssidref;
-                put_domain(rdom);
             } else {
                 spin_unlock(&d->evtchn_lock);
                 continue; /* port unused */

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

#1 lore raw
Quoted 5 lines · Stefan Berger

This patch simplifies the scanning of a domain's event channels considering that an 'ECS_UNBOUND' event channel is not connected and can be skipped.

This code is still broken: you are checking only the first event-channel in each bucket. You need a double loop: the new inner loop should iterate from 0 to EVTCHNS_PER_BUCKET-1.

ports = d->evtchn[bucket];
If ( ports == NULL )

    break;

for ( j = 0; j < EVTCHNS_PER_BUCKET; j++ )
.... process ports[j] ....

-- Keir