From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35354C433F5 for ; Tue, 28 Sep 2021 12:37:03 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECADF61159 for ; Tue, 28 Sep 2021 12:37:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ECADF61159 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.197989.351261 (Exim 4.92) (envelope-from ) id 1mVCLu-0005US-6o; Tue, 28 Sep 2021 12:36:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 197989.351261; Tue, 28 Sep 2021 12:36:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVCLu-0005UL-2z; Tue, 28 Sep 2021 12:36:54 +0000 Received: by outflank-mailman (input) for mailman id 197989; Tue, 28 Sep 2021 12:36:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mVCLt-0005UE-0E for xen-devel@lists.xenproject.org; Tue, 28 Sep 2021 12:36:53 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 58a6c5fc-84ef-49d0-b521-ac498aea12a7; Tue, 28 Sep 2021 12:36:51 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 58a6c5fc-84ef-49d0-b521-ac498aea12a7 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632832611; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Dcl3xvtyIEjWZIgMG1eaMInfPCnZCg1zs5WFrkQAlGo=; b=cI6XsgUmyuzjJw2AMOdgNBReHO9tOtoPqJTNKp9zkIM5qP7oLZSmAMdI yfUqERcSUHsYP8qZq/fhl2R5ycP7L3z89nadkyEf+ZacPPnnNMo48TdMJ 7GLhQoLVE5wlrSc0lhjCIh59P/cAC9TvuA17a5rkDZVTuhRnuSbukE6GT k=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: CNImGH9CT0ZjBr4wPVxUaBkR+ZDyBk1Co3nXelbXcP2kW691Fk6eaF6q1+NuEVW0dXKNV1zxMN kowoDTSszUG/FJRV9p5L6Fc0B0sZIsPk3pEANQEo+4yDTivM6OthsMd8U0P5K3Y/rCn0q5qZAg 9wInSwKzY9+TCovSlb4LmDaMANGQ0zZZT9fT+k/SXRT9VkSuUBEwJLfEQezQLWSaWTVg3Vlqiq y30UIWRL8NmNmFaeOHFBpG5YIG5wXdZcWvMxLAUbBnJJawEtrgL9qx4JOfwrPtJM1PlkF67+H9 /RUoHvhgd2eBxTLfaI0sPtK3 X-SBRS: 5.1 X-MesageID: 53819662 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:Orbkx6nfsWdocTppWZOLq8zo5gxiIURdPkR7XQ2eYbSJt1+Wr1Gzt xIeD2mFPK6LYzPwKthzOtuw9EgEu5PUmtE1GwRq+Hg1FSMWpZLJC+rCIxarNUt+D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m4KsFLsNldrg77u1zi/VzS qBdKcmHB/1OTBXB+igcMsah/NAzKkzziFLcJTehbRg+Y4VkG17D9Oj7c1a97yIJFCe265cz+ uXyygPBTJMfbA1+F8KKOum3xla8sCFFyuJ/VkfFOPdJf0Do/NQ4IiD9lKZvccoNNQ/C1n2R0 APPWUUUouzEookU9tjVhP/b89f1QrUmRkcDRjvV97e7MyXe71GP+44YXbbaZy3ZWUP15L6mO bdfwcbjPaBVh11NqYd9TepmlPps+9v1qrZG5Q14B3GXPU+zA7ZtL3Taj8lCsqpBmu1QtQesA x/d/9BbPfOCOd//EU5XLw0gN7zR2fYRkzjUzPI0PESlu3MnoOvZCR1fb0uWlShQDLppK4d0k +4utfkf5xG7lhd3YM2NiTpZ9jjUI3ENO0n9Wkr23GM/ZtIX92x/ IronPort-HdrOrdr: A9a23:PZV2Ea8U6qoMJZNhPoduk+DcI+orL9Y04lQ7vn2ZLiYlFfBw9v re+MjzsCWetN9/Yh0dcLy7V5VoIkm9yXcW2+cs1N6ZNWGN1VdAR7sC0aLShxHmBi3i5qp8+M 5bAs1D4QTLfDtHZBDBkWuFL+o= X-IronPort-AV: E=Sophos;i="5.85,329,1624334400"; d="scan'208";a="53819662" Date: Tue, 28 Sep 2021 13:36:45 +0100 From: Anthony PERARD To: Dmitry Isaykin CC: , Ian Jackson , Wei Liu Subject: Re: [PATCH v3] tools/xl: fix autoballoon regex Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: On Thu, Sep 16, 2021 at 03:15:21PM +0300, Dmitry Isaykin wrote: > This regex is used for auto-balloon mode detection based on Xen command line. > > The case of specifying a negative size was handled incorrectly. > From misc/xen-command-line documentation: > > dom0_mem (x86) > = List of ( min: | max: | ) > > If a size is positive, it represents an absolute value. > If a size is negative, it is subtracted from the total available memory. > > Also add support for [tT] granularity suffix. > Also add support for memory fractions (i.e. '50%' or '1G+25%'). > > Signed-off-by: Dmitry Isaykin > --- > ret = regcomp(®ex, > - "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )", > + "(^| )dom0_mem=((|min:|max:)(-?[0-9]+[bBkKmMgGtT]?)?(\+?[0-9]+%)?,?)+($| )", It seems that by trying to match fractions, the new regex would match too much. For example, if there is " dom0_mem= " on the command line, xl would detect it as autoballoon=off, while it isn't the case without this patch. I don't know if it is possible to have "dom0_mem=" on the command line as I don't know what Xen would do in this case. It might be better to make the regex more complicated and match fraction like they are described in the doc, something like: ( | (\+)?% ) unless xen doesn't boot with bogus value for dom0_mem, but I haven't checked. (we could use CPP macros to avoid duplicating the regex.) Also, is supposed to be < 100, so [0-9]{1,2} would be better to only match no more than 2 digit. Thought? Thanks, -- Anthony PERARD