[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V2 3/4] xen/unpopulated-alloc: Add mechanism to use Xen resource


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Thu, 28 Oct 2021 15:08:51 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MF0710uZFyMs26KIjmJUd9EACMS7DQrZSFE1vH8ah9Y=; b=AKKBSCT9pEDbN/2ivhVXYuYM58ZlXIF+MEAaFR2bFKBqJLxVFKg3n8yLMyvpnyPahcqRUZF+yi3PMno/D/mONQxZsPf4FP2/OPxAethj13qi6Zr7hVxfKe0/PRpTgwSwzqAesfWdwct7j0Pj/BwEvgG3qCv0eagqq1SPpmwCKxPdJicDk3ZWyc98jxQpsX2AMIe/bIThNPng4RHpXEJ+NdYT1nVRO79hfBL+wo3SAdqDEWbZzAUBfqAF741JZdWdrvYJSDoapuBGlyy0jqqkXcObVTzNr+6eA58+oVbY/kjQt+yJ4ejQKVlQlPRpPEia3QyOHsT5KTWTirlmKmxjiA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cWO8yqg6Kd2e1r0umMOS2vohgtXioIbSbXdOh9YkBecBfsxjtqWRZn80/QTzDwTKDRSnbplw/7i/Ssap42OFwIKx7eyPJX+qdQkEfkdP3FGIKSsZt2xwFCmW5D2j8o82kOYhJ96YCK2fbHEuSxl6AoN+OeV22cG1LiXAWFJHq6vwwyRcRT2SXdSnOJEZ8eELqak0uTMVoqHJQT0wn7y84GVkVUhkWHK2ib6IiM+5Qc3Mw7UyoeQx3EDIEwOv/tVJJXZxzMuVXCFTPsUe9B7i2PnFxNbRA+uxnFnXJCCzUkln0c6i9/kRqSykjezl8jndoamuONgQmIK6lUdWB6dPDA==
  • Authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com;
  • Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Thu, 28 Oct 2021 19:09:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 10/26/21 12:05 PM, Oleksandr Tyshchenko wrote:
+static void unpopulated_init(void)
+{
+       static bool inited = false;
+       int ret;
+
+       if (inited)
+               return;
+
+       /*
+        * Try to initialize Xen resource the first and fall back to default
+        * resource if arch doesn't offer one.
+        */
+       ret = arch_xen_unpopulated_init(&xen_resource);
+       if (!ret)
+               target_resource = &xen_resource;
+       else if (ret == -ENOSYS)
+               target_resource = &iomem_resource;
+       else
+               pr_err("Cannot initialize Xen resource\n");


I'd pass target_resource as a parameter to arch_xen_unpopulated_init() instead. 
Default routine will assign it iomem_resource and you won't have to deal with 
-ENOSYS.


Also, what happens in case of error? Is it fatal? I don't think your changes in 
fill_list() will work.


+
+       inited = true;


I agree with Stefano in that it would be better to call this from an init 
function, and you won't have t worry about multiple calls here.


-boris



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.