From minios-devel-bounces@lists.xenproject.org Mon Oct 04 09:40:13 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Oct 2021 09:40:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.201245.355684 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXKSB-0002OK-6D; Mon, 04 Oct 2021 09:40:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 201245.355684; Mon, 04 Oct 2021 09:40:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXKSB-0002O8-24; Mon, 04 Oct 2021 09:40:11 +0000
Received: by outflank-mailman (input) for mailman id 201245;
 Mon, 04 Oct 2021 09:40:10 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7SE7=OY=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1mXKSA-00024g-AE
 for minios-devel@lists.xenproject.org; Mon, 04 Oct 2021 09:40:10 +0000
Received: from smtp-out2.suse.de (unknown [195.135.220.29])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id 0c309f9c-24f7-11ec-bea7-12813bfff9fa;
 Mon, 04 Oct 2021 09:40:02 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id CADA62019A;
 Mon,  4 Oct 2021 09:40:01 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9787A13A13;
 Mon,  4 Oct 2021 09:40:01 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id /oXMI/HLWmG5RAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 04 Oct 2021 09:40:01 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 0c309f9c-24f7-11ec-bea7-12813bfff9fa
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1633340401; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=2fFPIPlC+atciMa/6CO3r585X3XUQbQXFh8lKdi63pg=;
	b=fl0U3dzb+07pemGi4N7J3gF5T+LVvmLKYcoGqCxtVVtGrYkT7V6oTkEyIcz1mH1CxsLooO
	0JG7aiedEVgf9JI6KPA/IY19M1Q9O8l7xrUI/tESKvw5rP8rYFWKzp4umKyo8MjDl9P05k
	DGouRhytjCBn19afksaVzJBTnXNaz+Y=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v4] xenbus: support large messages
Date: Mon,  4 Oct 2021 11:40:00 +0200
Message-Id: <20211004094000.29868-1-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Today the implementation of the xenbus protocol in Mini-OS will only
allow to transfer the complete message to or from the ring page buffer.
This is limiting the maximum message size to lower values as the xenbus
protocol normally would allow.

Change that by allowing to transfer the xenbus message in chunks as
soon as they are available.

Avoid crashing Mini-OS in case of illegal data read from the ring
buffer.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- drop redundant if (Samuel Thibault)
- move rmb() (Samuel Thibault)
V3:
- correct notification test (Samuel Thibault)
V4:
- more memory barriers (Samuel Thibault)
---
 xenbus/xenbus.c | 210 ++++++++++++++++++++++++++++--------------------
 1 file changed, 122 insertions(+), 88 deletions(-)

diff --git a/xenbus/xenbus.c b/xenbus/xenbus.c
index 23de61e..b687678 100644
--- a/xenbus/xenbus.c
+++ b/xenbus/xenbus.c
@@ -29,6 +29,7 @@
 #include <xen/hvm/params.h>
 #include <mini-os/spinlock.h>
 #include <mini-os/xmalloc.h>
+#include <mini-os/semaphore.h>
 
 #define min(x,y) ({                       \
         typeof(x) tmpx = (x);                 \
@@ -46,6 +47,7 @@
 static struct xenstore_domain_interface *xenstore_buf;
 static DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue);
+static __DECLARE_SEMAPHORE_GENERIC(xb_write_sem, 1);
 
 xenbus_event_queue xenbus_events;
 static struct watch {
@@ -231,75 +233,103 @@ char *xenbus_wait_for_state_change(const char* path, XenbusState *state, xenbus_
 }
 
 
+static void xenbus_read_data(char *buf, unsigned int len)
+{
+    unsigned int off = 0;
+    unsigned int prod, cons;
+    unsigned int size;
+
+    while (off != len)
+    {
+        wait_event(xb_waitq, xenstore_buf->rsp_prod != xenstore_buf->rsp_cons);
+
+        prod = xenstore_buf->rsp_prod;
+        cons = xenstore_buf->rsp_cons;
+        DEBUG("Rsp_cons %d, rsp_prod %d.\n", cons, prod);
+        size = min(len - off, prod - cons);
+
+        rmb();   /* Make sure data read from ring is ordered with rsp_prod. */
+        memcpy_from_ring(xenstore_buf->rsp, buf + off,
+                         MASK_XENSTORE_IDX(cons), size);
+        off += size;
+        mb();    /* memcpy() and rsp_cons update must not be reordered. */
+        xenstore_buf->rsp_cons += size;
+        mb();    /* rsp_cons must be visible before we look at rsp_prod. */
+        if (xenstore_buf->rsp_prod - cons >= XENSTORE_RING_SIZE)
+            notify_remote_via_evtchn(xenbus_evtchn);
+    }
+}
+
 static void xenbus_thread_func(void *ign)
 {
     struct xsd_sockmsg msg;
-    unsigned prod = xenstore_buf->rsp_prod;
+    char *data;
 
     for (;;) {
-        wait_event(xb_waitq, prod != xenstore_buf->rsp_prod);
-        while (1) {
-            prod = xenstore_buf->rsp_prod;
-            DEBUG("Rsp_cons %d, rsp_prod %d.\n", xenstore_buf->rsp_cons,
-                  xenstore_buf->rsp_prod);
-            if (xenstore_buf->rsp_prod - xenstore_buf->rsp_cons < sizeof(msg))
-                break;
-            rmb();
-            memcpy_from_ring(xenstore_buf->rsp, &msg,
-                             MASK_XENSTORE_IDX(xenstore_buf->rsp_cons),
-                             sizeof(msg));
-            DEBUG("Msg len %d, %d avail, id %d.\n", msg.len + sizeof(msg),
-                  xenstore_buf->rsp_prod - xenstore_buf->rsp_cons, msg.req_id);
-
-            if (xenstore_buf->rsp_prod - xenstore_buf->rsp_cons <
-                sizeof(msg) + msg.len)
-                break;
-
-            DEBUG("Message is good.\n");
-
-            if (msg.type == XS_WATCH_EVENT) {
-                struct xenbus_event *event = malloc(sizeof(*event) + msg.len);
-                xenbus_event_queue *events = NULL;
-                char *data = (char*)event + sizeof(*event);
-                struct watch *watch;
-
-                memcpy_from_ring(xenstore_buf->rsp, data,
-                    MASK_XENSTORE_IDX(xenstore_buf->rsp_cons + sizeof(msg)),
-                    msg.len);
-
-                event->path = data;
-                event->token = event->path + strlen(event->path) + 1;
-
-                mb();
-                xenstore_buf->rsp_cons += msg.len + sizeof(msg);
-
-                for (watch = watches; watch; watch = watch->next)
-                    if (!strcmp(watch->token, event->token)) {
-                        events = watch->events;
-                        break;
-                    }
-
-                if (events) {
-                    event->next = *events;
-                    *events = event;
-                    wake_up(&xenbus_watch_queue);
-                } else {
-                    printk("unexpected watch token %s\n", event->token);
-                    free(event);
+        xenbus_read_data((char *)&msg, sizeof(msg));
+        DEBUG("Msg len %d, %d avail, id %d.\n", msg.len + sizeof(msg),
+              xenstore_buf->rsp_prod - xenstore_buf->rsp_cons, msg.req_id);
+
+        if (msg.len > XENSTORE_PAYLOAD_MAX) {
+            printk("Xenstore violates protocol, message longer than allowed.\n");
+            return;
+        }
+
+        if (msg.type == XS_WATCH_EVENT) {
+            struct xenbus_event *event = malloc(sizeof(*event) + msg.len);
+            xenbus_event_queue *events = NULL;
+            struct watch *watch;
+            char *c;
+            int zeroes = 0;
+
+            data = (char*)event + sizeof(*event);
+            xenbus_read_data(data, msg.len);
+
+            for (c = data; c < data + msg.len; c++)
+                if (!*c)
+                    zeroes++;
+            if (zeroes != 2) {
+                printk("Xenstore: illegal watch event data\n");
+                free(event);
+                continue;
+            }
+
+            event->path = data;
+            event->token = event->path + strlen(event->path) + 1;
+
+            for (watch = watches; watch; watch = watch->next)
+                if (!strcmp(watch->token, event->token)) {
+                    events = watch->events;
+                    break;
                 }
+
+            if (events) {
+                event->next = *events;
+                *events = event;
+                wake_up(&xenbus_watch_queue);
             } else {
-                req_info[msg.req_id].reply = malloc(sizeof(msg) + msg.len);
-                memcpy_from_ring(xenstore_buf->rsp, req_info[msg.req_id].reply,
-                                 MASK_XENSTORE_IDX(xenstore_buf->rsp_cons),
-                                 msg.len + sizeof(msg));
-                mb();
-                xenstore_buf->rsp_cons += msg.len + sizeof(msg);
-                wake_up(&req_info[msg.req_id].waitq);
+                printk("Xenstore: unexpected watch token %s\n", event->token);
+                free(event);
             }
 
-            wmb();
-            notify_remote_via_evtchn(xenbus_evtchn);
+            continue;
         }
+
+        data = malloc(sizeof(msg) + msg.len);
+        memcpy(data, &msg, sizeof(msg));
+        xenbus_read_data(data + sizeof(msg), msg.len);
+
+        if (msg.req_id >= NR_REQS || !req_info[msg.req_id].in_use) {
+            printk("Xenstore: illegal request id %d\n", msg.req_id);
+            free(data);
+            continue;
+        }
+
+        DEBUG("Message is good.\n");
+
+        req_info[msg.req_id].reply = data;
+
+        wake_up(&req_info[msg.req_id].waitq);
     }
 }
 
@@ -451,36 +481,40 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
 
     cur_req = &header_req;
 
-    BUG_ON(len > XENSTORE_RING_SIZE);
-    /* Wait for the ring to drain to the point where we can send the
-       message. */
-    prod = xenstore_buf->req_prod;
-    if (prod + len - xenstore_buf->req_cons > XENSTORE_RING_SIZE) 
-    {
-        /* Wait for there to be space on the ring */
-        DEBUG("prod %d, len %d, cons %d, size %d; waiting.\n",
-                prod, len, xenstore_buf->req_cons, XENSTORE_RING_SIZE);
-        wait_event(xb_waitq,
-                xenstore_buf->req_prod + len - xenstore_buf->req_cons <=
-                XENSTORE_RING_SIZE);
-        DEBUG("Back from wait.\n");
-        prod = xenstore_buf->req_prod;
-    }
+    BUG_ON(len > XENSTORE_PAYLOAD_MAX);
+
+    /* Make sure we are the only thread trying to write. */
+    down(&xb_write_sem);
 
-    /* We're now guaranteed to be able to send the message without
-       overflowing the ring.  Do so. */
+    /* Send the message in chunks using free ring space when available. */
     total_off = 0;
     req_off = 0;
-    while (total_off < len) 
+    while (total_off < len)
     {
+        prod = xenstore_buf->req_prod;
+        if (prod - xenstore_buf->req_cons >= XENSTORE_RING_SIZE)
+        {
+            /* Send evtchn to notify remote */
+            notify_remote_via_evtchn(xenbus_evtchn);
+
+            /* Wait for there to be space on the ring */
+            DEBUG("prod %d, len %d, cons %d, size %d; waiting.\n", prod,
+                  len - total_off, xenstore_buf->req_cons, XENSTORE_RING_SIZE);
+            wait_event(xb_waitq,
+                       prod - xenstore_buf->req_cons < XENSTORE_RING_SIZE);
+            DEBUG("Back from wait.\n");
+        }
+
         this_chunk = min(cur_req->len - req_off,
-                XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(prod));
+                         XENSTORE_RING_SIZE - MASK_XENSTORE_IDX(prod));
+        this_chunk = min(this_chunk,
+                         xenstore_buf->req_cons + XENSTORE_RING_SIZE - prod);
         memcpy((char *)xenstore_buf->req + MASK_XENSTORE_IDX(prod),
-                (char *)cur_req->data + req_off, this_chunk);
+               (char *)cur_req->data + req_off, this_chunk);
         prod += this_chunk;
         req_off += this_chunk;
         total_off += this_chunk;
-        if (req_off == cur_req->len) 
+        if (req_off == cur_req->len)
         {
             req_off = 0;
             if (cur_req == &header_req)
@@ -488,20 +522,20 @@ static void xb_write(int type, int req_id, xenbus_transaction_t trans_id,
             else
                 cur_req++;
         }
+
+        /* Remote must see entire message before updating indexes */
+        wmb();
+        xenstore_buf->req_prod = prod;
     }
 
+    /* Send evtchn to notify remote */
+    notify_remote_via_evtchn(xenbus_evtchn);
+
     DEBUG("Complete main loop of xb_write.\n");
     BUG_ON(req_off != 0);
     BUG_ON(total_off != len);
-    BUG_ON(prod > xenstore_buf->req_cons + XENSTORE_RING_SIZE);
 
-    /* Remote must see entire message before updating indexes */
-    wmb();
-
-    xenstore_buf->req_prod += len;
-
-    /* Send evtchn to notify remote */
-    notify_remote_via_evtchn(xenbus_evtchn);
+    up(&xb_write_sem);
 }
 
 /* Send a mesasge to xenbus, in the same fashion as xb_write, and
-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Mon Oct 04 14:19:33 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Oct 2021 14:19:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.201539.356092 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOoV-0007Uk-Um; Mon, 04 Oct 2021 14:19:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 201539.356092; Mon, 04 Oct 2021 14:19:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOoV-0007Uc-RU; Mon, 04 Oct 2021 14:19:31 +0000
Received: by outflank-mailman (input) for mailman id 201539;
 Mon, 04 Oct 2021 14:19:30 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7SE7=OY=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1mXOoU-0007UW-S7
 for minios-devel@lists.xenproject.org; Mon, 04 Oct 2021 14:19:30 +0000
Received: from smtp-out2.suse.de (unknown [195.135.220.29])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id b55e299b-80d0-4722-ae83-8c39b72cd2a2;
 Mon, 04 Oct 2021 14:19:29 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 638A220206;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2CD2B13342;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id YB2xCXANW2EjcAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 04 Oct 2021 14:19:28 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: b55e299b-80d0-4722-ae83-8c39b72cd2a2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1633357168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:  content-transfer-encoding:content-transfer-encoding;
	bh=0AOhPZV+JXqC2xfl8dUUkVHXeqvYXj7VLkoveiuIiaU=;
	b=KVeGLE7kpF7v7Zc1Q51PTlyg47fyQALvDke73b8ICABdPJ8HgHcoAiNzVCrjUvJP2qaUsg
	ACXY2nqc1NyrAfql+VIjUTPyBnKnWw0gWBUZSSMQRDT8zeSGeEv0Q+rk/pbuwSrZmZRV9K
	iQ4YxONqNpFwm8iurtHzjJas/ILOOHg=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 0/2] mini-os: prepare mini-os stubdoms to use stable libs only
Date: Mon,  4 Oct 2021 16:19:22 +0200
Message-Id: <20211004141924.7088-1-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

When built as stubdom Mini-OS can't be linked to use only stable Xen
libraries, as there is only one config option for adding Xen library
support, which includes libxenctrl.

This series is changing that by adding dedicated config options for
each Xen library needing special support in Mini-OS.

Juergen Gross (2):
  mini-os: fix testbuilds regarding CONFIG_XC
  mini-os: add config options for xen libraries

 Config.mk                     | 8 +++++++-
 arch/x86/testbuild/all-no     | 4 +++-
 arch/x86/testbuild/all-yes    | 8 +++++---
 arch/x86/testbuild/newxen-yes | 8 +++++---
 lib/sys.c                     | 8 ++++++--
 5 files changed, 26 insertions(+), 10 deletions(-)

-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Mon Oct 04 14:19:42 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Oct 2021 14:19:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.201541.356106 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOog-0007qv-9p; Mon, 04 Oct 2021 14:19:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 201541.356106; Mon, 04 Oct 2021 14:19:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOog-0007qo-6k; Mon, 04 Oct 2021 14:19:42 +0000
Received: by outflank-mailman (input) for mailman id 201541;
 Mon, 04 Oct 2021 14:19:40 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7SE7=OY=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1mXOoe-0007UW-R1
 for minios-devel@lists.xenproject.org; Mon, 04 Oct 2021 14:19:40 +0000
Received: from smtp-out2.suse.de (unknown [195.135.220.29])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id eb28ed18-8dd0-44f3-b308-9b2cd0eaf583;
 Mon, 04 Oct 2021 14:19:29 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id 90F1820208;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 679A913AEF;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id gL4rGHANW2EjcAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 04 Oct 2021 14:19:28 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: eb28ed18-8dd0-44f3-b308-9b2cd0eaf583
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1633357168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=fH3DuqnGZJpT+DNy0zo8NCI7OWmYxQHUzvQItaNzehQ=;
	b=KNCxsc5Tvfa4QZzFM/Ijgv0HbzzfqF41gbC0lJPL8exwmbYrfbyQcKFCbChlwsQOHOmfre
	xity+WYdsZ2I0ZHUooPKjABuxS2xDWDPpygv/CWaILHvinmf1E1DXb1s4Ocwpfji83wJQ4
	0koLcmspZmP2bLr067oGSw342JTVEEY=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 1/2] mini-os: fix testbuilds regarding CONFIG_XC
Date: Mon,  4 Oct 2021 16:19:23 +0200
Message-Id: <20211004141924.7088-2-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20211004141924.7088-1-jgross@suse.com>
References: <20211004141924.7088-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

CONFIG_GC is requiring external support, so disable it in testbuilds.

The only reason this is working right now is its usage being inside
a HAVE_LIBC section.

Make that more obvious by making the default setting of CONFIG_XC
depending on libc being available.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Config.mk                     | 3 ++-
 arch/x86/testbuild/all-yes    | 3 ++-
 arch/x86/testbuild/newxen-yes | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 15311ef..8f4cea9 100644
--- a/Config.mk
+++ b/Config.mk
@@ -62,6 +62,7 @@ MINIOS_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
 MINIOS_TARGET_ARCH     ?= $(MINIOS_COMPILE_ARCH)
 endif
 
+stubdom ?= n
 libc = $(stubdom)
 
 XEN_INTERFACE_VERSION ?= 0x00030205
@@ -179,7 +180,6 @@ CONFIG-y += CONFIG_FBFRONT
 CONFIG-y += CONFIG_KBDFRONT
 CONFIG-y += CONFIG_CONSFRONT
 CONFIG-y += CONFIG_XENBUS
-CONFIG-y += CONFIG_XC
 CONFIG-n += CONFIG_QEMU_XS_ARGS
 CONFIG-n += CONFIG_TEST
 CONFIG-n += CONFIG_PCIFRONT
@@ -195,6 +195,7 @@ CONFIG-y += CONFIG_PARAVIRT
 else
 CONFIG-n += CONFIG_PARAVIRT
 endif
+CONFIG-$(libc) += CONFIG_XC
 CONFIG-$(lwip) += CONFIG_LWIP
 
 $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 8732e69..5464342 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -13,7 +13,8 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-CONFIG_XC = y
+# XC is special: it needs support from outside
+CONFIG_XC = n
 # LWIP is special: it needs support from outside
 CONFIG_LWIP = n
 CONFIG_BALLOON = y
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index 9c30c00..2a3ed2e 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -13,7 +13,8 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-CONFIG_XC = y
+# XC is special: it needs support from outside
+CONFIG_XC = n
 # LWIP is special: it needs support from outside
 CONFIG_LWIP = n
 CONFIG_BALLOON = y
-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Mon Oct 04 14:19:57 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Mon, 04 Oct 2021 14:19:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.201545.356133 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOov-0000P7-Uy; Mon, 04 Oct 2021 14:19:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 201545.356133; Mon, 04 Oct 2021 14:19:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXOov-0000Ox-RT; Mon, 04 Oct 2021 14:19:57 +0000
Received: by outflank-mailman (input) for mailman id 201545;
 Mon, 04 Oct 2021 14:19:55 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <SRS0=7SE7=OY=suse.com=jgross@srs-us1.protection.inumbo.net>)
 id 1mXOot-0007UW-RC
 for minios-devel@lists.xenproject.org; Mon, 04 Oct 2021 14:19:55 +0000
Received: from smtp-out2.suse.de (unknown [195.135.220.29])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id fea165a3-9fc8-4659-87e8-c3c3207b87ac;
 Mon, 04 Oct 2021 14:19:29 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by smtp-out2.suse.de (Postfix) with ESMTPS id C11A320209;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512)
 (No client certificate requested)
 by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9662E13342;
 Mon,  4 Oct 2021 14:19:28 +0000 (UTC)
Received: from dovecot-director2.suse.de ([192.168.254.65])
 by imap2.suse-dmz.suse.de with ESMTPSA id EBd+I3ANW2EjcAAAMHmgww
 (envelope-from <jgross@suse.com>); Mon, 04 Oct 2021 14:19:28 +0000
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: fea165a3-9fc8-4659-87e8-c3c3207b87ac
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1;
	t=1633357168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:
	 mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=y5GfRa8P1HM/l2d/V3JUY7JMhDq7I4DxXT7aS9qRvTY=;
	b=W3eGR43ESS6dXdxEmY4LcCwF28K5utJUzvDFY9+A42Rt0U0pJy4aIE9Nv4P9mofsPdFDIQ
	hDOODF0d5Xk/l616m8UcyenxTdkMgfsiG7AnBveF/a3k/m2M/qMaWZJlS53ozqHhiqYgTv
	s2GzF6oqJniMQaDs8QGYmfaUngdCF3Y=
From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org,
	wl@xen.org,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH 2/2] mini-os: add config options for xen libraries
Date: Mon,  4 Oct 2021 16:19:24 +0200
Message-Id: <20211004141924.7088-3-jgross@suse.com>
X-Mailer: git-send-email 2.26.2
In-Reply-To: <20211004141924.7088-1-jgross@suse.com>
References: <20211004141924.7088-1-jgross@suse.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Today close hooks into libxenctrl, libxenevtchn and libxengnttab are
under the CONFIG_XC umbrella. In order to support Mini-OS builds using
stable Xen libraries only, add CONFIG_LIBXENCTRL, CONFIG_LIBXENEVTCHN
and CONFIG_LIBXENGNTTAB config options.

In case CONFIG_XC was specified in the Mini-OS config explicitly, set
the three new variables to the specified value.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 Config.mk                     | 7 ++++++-
 arch/x86/testbuild/all-no     | 4 +++-
 arch/x86/testbuild/all-yes    | 9 +++++----
 arch/x86/testbuild/newxen-yes | 9 +++++----
 lib/sys.c                     | 8 ++++++--
 5 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8f4cea9..5e66089 100644
--- a/Config.mk
+++ b/Config.mk
@@ -195,7 +195,12 @@ CONFIG-y += CONFIG_PARAVIRT
 else
 CONFIG-n += CONFIG_PARAVIRT
 endif
-CONFIG-$(libc) += CONFIG_XC
+# Support legacy CONFIG_XC value
+CONFIG_XC ?= $(libc)
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENCTRL
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
+CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
+
 CONFIG-$(lwip) += CONFIG_LWIP
 
 $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index 1c50bba..7972ecd 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -13,7 +13,9 @@ CONFIG_FBFRONT = n
 CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
 CONFIG_XENBUS = n
-CONFIG_XC = n
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
 CONFIG_LWIP = n
 CONFIG_BALLOON = n
 CONFIG_USE_XEN_CONSOLE = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index 5464342..bc8eea5 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -13,9 +13,10 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-# XC is special: it needs support from outside
-CONFIG_XC = n
-# LWIP is special: it needs support from outside
-CONFIG_LWIP = n
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
+# The following are special: they need support from outside
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
+CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index 2a3ed2e..f72123b 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -13,10 +13,11 @@ CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
 CONFIG_XENBUS = y
-# XC is special: it needs support from outside
-CONFIG_XC = n
-# LWIP is special: it needs support from outside
-CONFIG_LWIP = n
 CONFIG_BALLOON = y
 CONFIG_USE_XEN_CONSOLE = y
 XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
+# The following are special: they need support from outside
+CONFIG_LIBXENCTRL = n
+CONFIG_LIBXENEVTCHN = n
+CONFIG_LIBXENGNTTAB = n
+CONFIG_LWIP = n
diff --git a/lib/sys.c b/lib/sys.c
index c6a7b9f..e8d5eb2 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -437,13 +437,17 @@ int close(int fd)
 	    return res;
 	}
 #endif
-#ifdef CONFIG_XC
+#ifdef CONFIG_LIBXENCTRL
 	case FTYPE_XC:
 	    minios_interface_close_fd(fd);
 	    return 0;
+#endif
+#ifdef CONFIG_LIBXENEVTCHN
 	case FTYPE_EVTCHN:
 	    minios_evtchn_close_fd(fd);
             return 0;
+#endif
+#ifdef CONFIG_LIBXENGNTTAB
 	case FTYPE_GNTMAP:
 	    minios_gnttab_close_fd(fd);
 	    return 0;
@@ -1373,7 +1377,7 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
 
     if (fd == -1)
         return map_zero(n, 1);
-#ifdef CONFIG_XC
+#ifdef CONFIG_LIBXENCTRL
     else if (files[fd].type == FTYPE_XC) {
         unsigned long zero = 0;
         return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, NULL, 0);
-- 
2.26.2



From minios-devel-bounces@lists.xenproject.org Tue Oct 05 21:26:44 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 05 Oct 2021 21:26:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.202494.357452 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXrxS-0006ts-PV; Tue, 05 Oct 2021 21:26:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 202494.357452; Tue, 05 Oct 2021 21:26:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXrxS-0006tk-M7; Tue, 05 Oct 2021 21:26:42 +0000
Received: by outflank-mailman (input) for mailman id 202494;
 Tue, 05 Oct 2021 21:26:42 +0000
Received: from us1-rack-iad1.inumbo.com ([172.99.69.81])
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Hd/I=OZ=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1mXrxS-0006cD-2J
 for minios-devel@lists.xenproject.org; Tue, 05 Oct 2021 21:26:42 +0000
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-rack-iad1.inumbo.com (Halon) with ESMTPS
 id 008071b5-0b90-4e3c-9f0b-7548d29c184c;
 Tue, 05 Oct 2021 21:26:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 28C29456;
 Tue,  5 Oct 2021 23:26:33 +0200 (CEST)
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Xkkca_-2_iAr; Tue,  5 Oct 2021 23:26:32 +0200 (CEST)
Received: from begin.home (acaen-652-1-186-147.w86-215.abo.wanadoo.fr
 [86.215.106.147])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id 980D9243;
 Tue,  5 Oct 2021 23:26:31 +0200 (CEST)
Received: from samy by begin.home with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1mXrxG-00G23n-Fl;
 Tue, 05 Oct 2021 23:26:30 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: 008071b5-0b90-4e3c-9f0b-7548d29c184c
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Date: Tue, 5 Oct 2021 23:26:30 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 1/2] mini-os: fix testbuilds regarding CONFIG_XC
Message-ID: <20211005212630.cj7z6xcuyb4iqvyv@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20211004141924.7088-1-jgross@suse.com>
 <20211004141924.7088-2-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20211004141924.7088-2-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-Spamd-Bar: --
Authentication-Results: hera.aquilenet.fr
X-Rspamd-Server: hera
X-Rspamd-Queue-Id: 28C29456
X-Spamd-Result: default: False [-2.50 / 15.00];
	 ARC_NA(0.00)[];
	 RCVD_VIA_SMTP_AUTH(0.00)[];
	 FROM_HAS_DN(0.00)[];
	 RCPT_COUNT_THREE(0.00)[4];
	 TO_DN_SOME(0.00)[];
	 TO_MATCH_ENVRCPT_ALL(0.00)[];
	 MIME_GOOD(-0.10)[text/plain];
	 HAS_ORG_HEADER(0.00)[];
	 RCVD_COUNT_THREE(0.00)[3];
	 RCVD_NO_TLS_LAST(0.10)[];
	 FROM_EQ_ENVFROM(0.00)[];
	 MID_RHS_NOT_FQDN(0.50)[];
	 BAYES_HAM(-3.00)[100.00%]

Juergen Gross, le lun. 04 oct. 2021 16:19:23 +0200, a ecrit:
> CONFIG_GC is requiring external support, so disable it in testbuilds.
> 
> The only reason this is working right now is its usage being inside
> a HAVE_LIBC section.
> 
> Make that more obvious by making the default setting of CONFIG_XC
> depending on libc being available.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
>  Config.mk                     | 3 ++-
>  arch/x86/testbuild/all-yes    | 3 ++-
>  arch/x86/testbuild/newxen-yes | 3 ++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/Config.mk b/Config.mk
> index 15311ef..8f4cea9 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -62,6 +62,7 @@ MINIOS_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
>  MINIOS_TARGET_ARCH     ?= $(MINIOS_COMPILE_ARCH)
>  endif
>  
> +stubdom ?= n
>  libc = $(stubdom)
>  
>  XEN_INTERFACE_VERSION ?= 0x00030205
> @@ -179,7 +180,6 @@ CONFIG-y += CONFIG_FBFRONT
>  CONFIG-y += CONFIG_KBDFRONT
>  CONFIG-y += CONFIG_CONSFRONT
>  CONFIG-y += CONFIG_XENBUS
> -CONFIG-y += CONFIG_XC
>  CONFIG-n += CONFIG_QEMU_XS_ARGS
>  CONFIG-n += CONFIG_TEST
>  CONFIG-n += CONFIG_PCIFRONT
> @@ -195,6 +195,7 @@ CONFIG-y += CONFIG_PARAVIRT
>  else
>  CONFIG-n += CONFIG_PARAVIRT
>  endif
> +CONFIG-$(libc) += CONFIG_XC
>  CONFIG-$(lwip) += CONFIG_LWIP
>  
>  $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
> diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
> index 8732e69..5464342 100644
> --- a/arch/x86/testbuild/all-yes
> +++ b/arch/x86/testbuild/all-yes
> @@ -13,7 +13,8 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -CONFIG_XC = y
> +# XC is special: it needs support from outside
> +CONFIG_XC = n
>  # LWIP is special: it needs support from outside
>  CONFIG_LWIP = n
>  CONFIG_BALLOON = y
> diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
> index 9c30c00..2a3ed2e 100644
> --- a/arch/x86/testbuild/newxen-yes
> +++ b/arch/x86/testbuild/newxen-yes
> @@ -13,7 +13,8 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -CONFIG_XC = y
> +# XC is special: it needs support from outside
> +CONFIG_XC = n
>  # LWIP is special: it needs support from outside
>  CONFIG_LWIP = n
>  CONFIG_BALLOON = y
> -- 
> 2.26.2
> 

-- 
Samuel
<k> faut en profiter, aujourd'hui, les blagues bidon sont à 100 dollars
 -+- #sos-bourse -+-


From minios-devel-bounces@lists.xenproject.org Tue Oct 05 21:27:01 2021
Return-path: <minios-devel-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xenproject.org
Delivery-date: Tue, 05 Oct 2021 21:27:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.202499.357467 (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXrxl-0007Tr-A7; Tue, 05 Oct 2021 21:27:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 202499.357467; Tue, 05 Oct 2021 21:27:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <minios-devel-bounces@lists.xenproject.org>)
	id 1mXrxl-0007Tl-6K; Tue, 05 Oct 2021 21:27:01 +0000
Received: by outflank-mailman (input) for mailman id 202499;
 Tue, 05 Oct 2021 21:27:00 +0000
Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]
 helo=us1-amaz-eas2.inumbo.com)
 by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from
 <SRS0=Hd/I=OZ=ens-lyon.org=samuel.thibault@srs-us1.protection.inumbo.net>)
 id 1mXrxk-0006zz-7G
 for minios-devel@lists.xenproject.org; Tue, 05 Oct 2021 21:27:00 +0000
Received: from hera.aquilenet.fr (unknown [185.233.100.1])
 by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS
 id f3ca4b3a-2622-11ec-bf16-12813bfff9fa;
 Tue, 05 Oct 2021 21:26:52 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 037EA456;
 Tue,  5 Oct 2021 23:26:51 +0200 (CEST)
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 4XB4179NegOe; Tue,  5 Oct 2021 23:26:50 +0200 (CEST)
Received: from begin.home (acaen-652-1-186-147.w86-215.abo.wanadoo.fr
 [86.215.106.147])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id B2B53243;
 Tue,  5 Oct 2021 23:26:49 +0200 (CEST)
Received: from samy by begin.home with local (Exim 4.95)
 (envelope-from <samuel.thibault@ens-lyon.org>) id 1mXrxZ-00G25D-2x;
 Tue, 05 Oct 2021 23:26:49 +0200
X-BeenThere: minios-devel@lists.xenproject.org
List-Id: Mini-os development list <minios-devel.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:minios-devel@lists.xenproject.org>
List-Help: <mailto:minios-devel-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/minios-devel>, 
 <mailto:minios-devel-request@lists.xenproject.org?subject=subscribe>
Errors-To: minios-devel-bounces@lists.xenproject.org
Precedence: list
Sender: "Minios-devel" <minios-devel-bounces@lists.xenproject.org>
X-Inumbo-ID: f3ca4b3a-2622-11ec-bf16-12813bfff9fa
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Date: Tue, 5 Oct 2021 23:26:49 +0200
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org,
	wl@xen.org
Subject: Re: [PATCH 2/2] mini-os: add config options for xen libraries
Message-ID: <20211005212649.pqlwdgwd4amkzrv7@begin>
Mail-Followup-To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Juergen Gross <jgross@suse.com>, minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wl@xen.org
References: <20211004141924.7088-1-jgross@suse.com>
 <20211004141924.7088-3-jgross@suse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20211004141924.7088-3-jgross@suse.com>
Organization: I am not organized
User-Agent: NeoMutt/20170609 (1.8.3)
X-Spamd-Bar: --
Authentication-Results: hera.aquilenet.fr
X-Rspamd-Server: hera
X-Rspamd-Queue-Id: 037EA456
X-Spamd-Result: default: False [-2.50 / 15.00];
	 ARC_NA(0.00)[];
	 RCVD_VIA_SMTP_AUTH(0.00)[];
	 FROM_HAS_DN(0.00)[];
	 RCPT_COUNT_THREE(0.00)[4];
	 TO_DN_SOME(0.00)[];
	 TO_MATCH_ENVRCPT_ALL(0.00)[];
	 MIME_GOOD(-0.10)[text/plain];
	 HAS_ORG_HEADER(0.00)[];
	 RCVD_COUNT_THREE(0.00)[3];
	 RCVD_NO_TLS_LAST(0.10)[];
	 FROM_EQ_ENVFROM(0.00)[];
	 MID_RHS_NOT_FQDN(0.50)[];
	 BAYES_HAM(-3.00)[100.00%]

Juergen Gross, le lun. 04 oct. 2021 16:19:24 +0200, a ecrit:
> Today close hooks into libxenctrl, libxenevtchn and libxengnttab are
> under the CONFIG_XC umbrella. In order to support Mini-OS builds using
> stable Xen libraries only, add CONFIG_LIBXENCTRL, CONFIG_LIBXENEVTCHN
> and CONFIG_LIBXENGNTTAB config options.
> 
> In case CONFIG_XC was specified in the Mini-OS config explicitly, set
> the three new variables to the specified value.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
>  Config.mk                     | 7 ++++++-
>  arch/x86/testbuild/all-no     | 4 +++-
>  arch/x86/testbuild/all-yes    | 9 +++++----
>  arch/x86/testbuild/newxen-yes | 9 +++++----
>  lib/sys.c                     | 8 ++++++--
>  5 files changed, 25 insertions(+), 12 deletions(-)
> 
> diff --git a/Config.mk b/Config.mk
> index 8f4cea9..5e66089 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -195,7 +195,12 @@ CONFIG-y += CONFIG_PARAVIRT
>  else
>  CONFIG-n += CONFIG_PARAVIRT
>  endif
> -CONFIG-$(libc) += CONFIG_XC
> +# Support legacy CONFIG_XC value
> +CONFIG_XC ?= $(libc)
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENCTRL
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENEVTCHN
> +CONFIG-$(CONFIG_XC) += CONFIG_LIBXENGNTTAB
> +
>  CONFIG-$(lwip) += CONFIG_LWIP
>  
>  $(foreach i,$(CONFIG-y),$(eval $(i) ?= y))
> diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
> index 1c50bba..7972ecd 100644
> --- a/arch/x86/testbuild/all-no
> +++ b/arch/x86/testbuild/all-no
> @@ -13,7 +13,9 @@ CONFIG_FBFRONT = n
>  CONFIG_KBDFRONT = n
>  CONFIG_CONSFRONT = n
>  CONFIG_XENBUS = n
> -CONFIG_XC = n
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
>  CONFIG_LWIP = n
>  CONFIG_BALLOON = n
>  CONFIG_USE_XEN_CONSOLE = n
> diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
> index 5464342..bc8eea5 100644
> --- a/arch/x86/testbuild/all-yes
> +++ b/arch/x86/testbuild/all-yes
> @@ -13,9 +13,10 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -# XC is special: it needs support from outside
> -CONFIG_XC = n
> -# LWIP is special: it needs support from outside
> -CONFIG_LWIP = n
>  CONFIG_BALLOON = y
>  CONFIG_USE_XEN_CONSOLE = y
> +# The following are special: they need support from outside
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
> +CONFIG_LWIP = n
> diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
> index 2a3ed2e..f72123b 100644
> --- a/arch/x86/testbuild/newxen-yes
> +++ b/arch/x86/testbuild/newxen-yes
> @@ -13,10 +13,11 @@ CONFIG_FBFRONT = y
>  CONFIG_KBDFRONT = y
>  CONFIG_CONSFRONT = y
>  CONFIG_XENBUS = y
> -# XC is special: it needs support from outside
> -CONFIG_XC = n
> -# LWIP is special: it needs support from outside
> -CONFIG_LWIP = n
>  CONFIG_BALLOON = y
>  CONFIG_USE_XEN_CONSOLE = y
>  XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
> +# The following are special: they need support from outside
> +CONFIG_LIBXENCTRL = n
> +CONFIG_LIBXENEVTCHN = n
> +CONFIG_LIBXENGNTTAB = n
> +CONFIG_LWIP = n
> diff --git a/lib/sys.c b/lib/sys.c
> index c6a7b9f..e8d5eb2 100644
> --- a/lib/sys.c
> +++ b/lib/sys.c
> @@ -437,13 +437,17 @@ int close(int fd)
>  	    return res;
>  	}
>  #endif
> -#ifdef CONFIG_XC
> +#ifdef CONFIG_LIBXENCTRL
>  	case FTYPE_XC:
>  	    minios_interface_close_fd(fd);
>  	    return 0;
> +#endif
> +#ifdef CONFIG_LIBXENEVTCHN
>  	case FTYPE_EVTCHN:
>  	    minios_evtchn_close_fd(fd);
>              return 0;
> +#endif
> +#ifdef CONFIG_LIBXENGNTTAB
>  	case FTYPE_GNTMAP:
>  	    minios_gnttab_close_fd(fd);
>  	    return 0;
> @@ -1373,7 +1377,7 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset
>  
>      if (fd == -1)
>          return map_zero(n, 1);
> -#ifdef CONFIG_XC
> +#ifdef CONFIG_LIBXENCTRL
>      else if (files[fd].type == FTYPE_XC) {
>          unsigned long zero = 0;
>          return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, NULL, 0);
> -- 
> 2.26.2
> 

-- 
Samuel
<y> update-menus: relocation error: update-menus: symbol _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E, version GLIBCPP_3.2 not defined in file libstdc++.so.5 with link time reference
<y> quoi que ça peut bien vouloir dire ?
<D> N a eu la meme merde
<y> c ça que ça veut dire ? wow, c'est bien crypté :)
 -+- #ens-mim s'entraide -+-


