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

Re: [PATCH v2 1/2] gnttab: adjust pin count overflow checks


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 15 Jan 2021 15:38:28 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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-SenderADCheck; bh=k1EemhJ8PKhGY9gy/JwGUSAc8pDDvC4+uavCgKWnwDc=; b=Vq0NexOt9HKIvljiTs7/Gftev27S+QtPP1P9KPArDHUkMiXf9wb2P9sQn6+9u1Vf+yaB8C6+EamWmL+ufaBiB0Ok2Lfll8PQKPU76wu4GikmzLYS8pShzOSAAPEks3SrGT2wIZWs5TEES8A/Mfr25mFW5rM/bLx2eTWxt96SjWcz2FCqHZjOoXqTMzH2VZz4QLmI88woWL6zL35PJZQugk/aySmUcsXYOVyrcQEovapb1CNc3qPKl5NbljeHbuo3kI7N1KFbpSXo5bQmzxZQh3TSu9Uo7jpw29zQz9sBlvYGe9GyGbzOm2/fwzDvSgETppCPqv1+46ApspLHCCQdfA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CEQEIzNpKhvuoMoIaj+r5euL6D7VkmO9Lc2il0lJtSshQO7wGP/M6P3uv0FoPdDSdRBMcq4lHbbqf8ywWBXUsVUn3Wrbgt21ZJ49QeAzbVYwJAvxQ3tSfNpvBRRYjw8WFbPTJvauRHcTyd5ta19JZMsrtXZhYm4CGEezi2k8R0ZShbNo7kD5jqbbBEwVWq6I2cPJ8XD8UyoptDIrGu7qjZ7CzicTSFtTe+qZqVFDBxDCGJzHtlcWVvZC3KCYVtrco6W/ripL9qRHgxSA8VtJc+FPe89x0Rbo2BSFcC56CAMUWWebSrrVR5uA0wj8I+LirzTUPVH7mfRADhsVWCD94Q==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 15 Jan 2021 15:38:42 +0000
  • Ironport-sdr: 1iRNl+51ktj7NvaLhU7FCPT09ecoLO3GjNqNnSifyjmy8WuwF6Hc0ePH13d4wfbI3LnKQPEUra qM8uIxM6kxv838ftA7Dow07C2pGW3SeJ3aTP+lyBFzCLY3m/UqpgjvHEezBI3VWfitHLVCG/gw qACRJyqHG8fFRj9H35lwAv5vjahYO8+BRx/jI8G4Xl7aQqL/ILEz4B+1ne1NGlZzw5O/GWY9sQ xhYjYGFfXSyNEjIrx7Dgvh+xOBqvQnjuPFYK7G7RZ09UU/GhsulFhxEtfy1ndKOBGbhh4jJYnG bQc=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15/01/2021 15:14, Jan Beulich wrote:
> It's at least odd to check counters which aren't going to be
> incremented, resulting in failure just because prior operations may
> have left an entry in an unusual state.

I wouldn't say it's an unusual state.  It can happen legally when you
map the same gref 128 times

Why a guest would do this in normal operation is a different question.

Perhaps "prior operations may have reached the refcount limit" ?

>  And it's also not helpful to
> use open-coded literal numbers in these checks.
>
> Calculate the increment values first and derive from them the mask to
> use in the checks.
>
> Also move the pin count checks ahead of the calculation of the status
> (and for copy also sha2) pointers: They're not needed in the failure
> cases, and this way the compiler may also have an easier time keeping
> the variables at least transiently in registers for the subsequent uses.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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