From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhen shi Subject: some questions of IO ring in xenpaging Date: Thu, 1 Sep 2011 01:02:54 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=0015174be08064387904abd01977 Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: olaf@aepfle.de Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --0015174be08064387904abd01977 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Hi Olaf -- I have two questions to ask you about xenpaging. 1) When guest os causes page_fault for the accessed page is paging_out or paged,it will execute p2m_mem_paging_populate() . and in p2m_mem_paging_populate() it will first check if the ring is full. when I ran with domU suse11 4G memory and 8vcpus,I found there will be a corruption in checking the ring. For example,if 4vcpus are met with page faults when they access different pages,and there is only four free-requests for the ring. and then they call p2m_mem_paging_populate(),and execute mem_event_check_ring(d) at the same time.All will find ring is not full,and will fill the requests.It will cause the latter request to cover the front request. and I think there should a lock before the mem_event_check_ring(d) ,and normally it unlock after mem_event_put_request(d, &req). You can review the attached doc of xenpaging_IO_ring.txt to see if my opnion is right. 2)mem_sharing and xenpaging are shared with one IO ring for domU.In the function of mem_sharing_alloc_page(),if alloc_domheap_page(d, 0) returns NULL,then it will pause VCPU ,check if the ring is full,and fill the request at last. I think there is also a corruption of mem_event_check_ring(d) with it in p2m_mem_paging_populate().We should assure exclusively in reading the free_request and puting requests. What's more,although it hardly fails in alloc_domheap_page(d, 0) from mem_sharing_alloc_page() ,it will fill the requests in IO ring. But in xenpaging when handling the page_in requests,we have not distinguished the requests with flag "MEM_EVENT_FLAG_VCPU_PAUSED" from paging or sharing.It will cause if the request is from mem_sharing_alloc_page(),it will go to p2m_mem_paging_resume() at last,and the page's p2mt is p2m_ram_rw.I think this is wrong.Maybe we should add the req.type when page in . I'm so sorry to have a poor English.But I look forward to your early reply. Thank you=A3=A1 --0015174be08064387904abd01977 Content-Type: text/plain; charset=US-ASCII; name="xenpaging_IO_ring.txt" Content-Disposition: attachment; filename="xenpaging_IO_ring.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gs0jy6ho1 dm9pZCBwMm1fbWVtX3BhZ2luZ19wb3B1bGF0ZShzdHJ1Y3QgcDJtX2RvbWFpbiAqcDJtLCB1bnNp Z25lZCBsb25nIGdmbikNCnsNCiAgICBzdHJ1Y3QgdmNwdSAqdiA9IGN1cnJlbnQ7DQogICAgbWVt X2V2ZW50X3JlcXVlc3RfdCByZXE7DQogICAgcDJtX3R5cGVfdCBwMm10Ow0KICAgIHN0cnVjdCBk b21haW4gKmQgPSBwMm0tPmRvbWFpbjsNCg0KICsgIHAybV9sb2NrKHAybSk7DQogICAgLyogQ2hl Y2sgdGhhdCB0aGVyZSdzIHNwYWNlIG9uIHRoZSByaW5nIGZvciB0aGlzIHJlcXVlc3QgKi8NCiAg ICBpZiAoIG1lbV9ldmVudF9jaGVja19yaW5nKGQpICkNCisgIHsNCisgICAgIHAybV91bmxvY2so cDJtKTsNCiAgICAgICAgcmV0dXJuOw0KKyB9DQoNCiAgICBtZW1zZXQoJnJlcSwgMCwgc2l6ZW9m KHJlcSkpOw0KICAgIHJlcS50eXBlID0gTUVNX0VWRU5UX1RZUEVfUEFHSU5HOw0KDQogICAgLyog Rml4IHAybSBtYXBwaW5nICovDQogICAgLyogWFhYOiBJdCBzZWVtcyBpbmVmZmljaWVudCB0byBo YXZlIHRoaXMgaGVyZSwgYXMgaXQncyBvbmx5IG5lZWRlZA0KICAgICAqICAgICAgaW4gb25lIGNh c2UgKGVwdCBndWVzdCBhY2Nlc3NpbmcgcGFnaW5nIG91dCBwYWdlKSAqLw0KICAgIGdmbl90b19t Zm4ocDJtLCBnZm4sICZwMm10KTsNCiAgICBpZiAoIHAybXQgPT0gcDJtX3JhbV9wYWdlZCApDQog ICAgew0KLSAgICAgIHAybV9sb2NrKHAybSk7DQogICAgICAgIHNldF9wMm1fZW50cnkocDJtLCBn Zm4sIF9tZm4oUEFHSU5HX01GTiksIDAsIHAybV9yYW1fcGFnaW5nX2luX3N0YXJ0LCBwMm0tPmRl ZmF1bHRfYWNjZXNzKTsNCiAgICAgICAgYXVkaXRfcDJtKHAybSwgMSk7DQotICAgICBwMm1fdW5s b2NrKHAybSk7DQogICAgfQ0KDQogICAgLyogUGF1c2UgZG9tYWluICovDQogICAgaWYgKCB2LT5k b21haW4tPmRvbWFpbl9pZCA9PSBkLT5kb21haW5faWQgKQ0KICAgIHsNCiAgICAgICAgdmNwdV9w YXVzZV9ub3N5bmModik7DQogICAgICAgIHJlcS5mbGFncyB8PSBNRU1fRVZFTlRfRkxBR19WQ1BV X1BBVVNFRDsNCiAgICB9DQogICAgZWxzZSBpZiAoIHAybXQgIT0gcDJtX3JhbV9wYWdpbmdfb3V0 ICYmIHAybXQgIT0gcDJtX3JhbV9wYWdlZCApDQogICAgew0KICAgICAgICAvKiBnZm4gaXMgYWxy ZWFkeSBvbiBpdHMgd2F5IGJhY2sgYW5kIHZjcHUgaXMgbm90IHBhdXNlZCAqLw0KKyAgICAgcDJt X3VubG9jayhwMm0pOw0KICAgICAgICByZXR1cm47DQogICAgfQ0KDQogICAgLyogU2VuZCByZXF1 ZXN0IHRvIHBhZ2VyICovDQogICAgcmVxLmdmbiA9IGdmbjsNCiAgICByZXEucDJtdCA9IHAybXQ7 DQogICAgcmVxLnZjcHVfaWQgPSB2LT52Y3B1X2lkOw0KDQogICAgbWVtX2V2ZW50X3B1dF9yZXF1 ZXN0KGQsICZyZXEpOw0KKyBwMm1fdW5sb2NrKHAybSk7DQp9DQo= --0015174be08064387904abd01977 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --0015174be08064387904abd01977--