[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] xsm: refactor xsm_ops handling
- To: Jan Beulich <jbeulich@xxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Fri, 18 Jun 2021 12:45:48 +0100
- 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=QGKFxGyTtatTV1/5mlTLYWzymcf6l52Oic+FjnOF2/U=; b=bkIMTMUeKZnW5SzEjjFWlm3EMdcQm3W0PN8k/TmAKPmHAVOwGH1mHHSF0FPvfJIOIvWle04BZIVoyuVhNMd3u15fGyKoik1mSpihrAKMK6vM0autf3d4Wb8i/tVERqC3xq2LZe2fsUdjDL6EcXxUZLXcyTfcbfDbAbqmLWqRlyulGhBcQuEWFP7lFFACm7RyvQLLDS6CvJIawIcSFhE+EMNtlY7jZ1Kp+LGr+Tm9PlBwecRPRGS0deXEK74LH7PkjhQQGcVYeB61+UYz4YEBTS5Z/lnID/5inS/KyjgfmFoh6RgCU8cm6OwVfZSaGQmNB7IdOYOA6AmtJJCoxGNlEA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RnTj67ZdkGp5V5ibX0jI+qKQRD9HRj8jcdmkgsQI9Cr2XuDZLSwsDt+zFCGztGE4CIDDzLWqAxy9qaiJb/eLTTE+ojreg5KmMB+QNjxAOWBKonUwGlvzG4zL/yXqf9IN4Oo1jlEKKlmsKUiOb5IxGRJhp+YDK9yysMOaI+JLsA5/t2JRs9g7GrSO5GcEyyKMaLkC6R/2kcD1P238tj/m1IQfpp39dO6d4ZbEoo9QvKmfIwbjkBsvNQPc4gZGteLYMmhVXEVipT1J0OR49thQjPVujgNChNiO14LLTB+dmZS08c3NMKKE3X4S5ZPnduXxMcTqqGsANFoENhN9ZcpC+g==
- Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Tamas K Lengyel" <tamas@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, "Petre Pircalabu" <ppircalabu@xxxxxxxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, <persaur@xxxxxxxxx>, <christopher.w.clark@xxxxxxxxx>, <adam.schwalm@xxxxxxxxxx>, <scott.davis@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Fri, 18 Jun 2021 11:46:10 +0000
- Ironport-hdrordr: A9a23:+P7hNq0/LRHXDPfG7OOxqgqjBSlyeYIsimQD101hICG9Lfb3qy n+ppsmPEHP5Ar5OEtBpTiBUJPwJk80hqQFn7X5Wo3SIzUO2VHYUL2KiLGC/9SOIVyEygcw79 YYT0E6MqyMMbEYt7eJ3ODbKadZ/DDvysnB7o2yvhQdL3AfV0gj1XYeNu/yKDwEeOAsP+tdKH Pz3Lsim9PtQwVsUiztbUN1L9Qr6ue71a4PJnU9dlYawTjLqQntxK/xEhCe0BtbezRTwY06+W yAtwDi/K2sv9yy1xeZjgbontdrseqk7uEGKN2Hi8ATJDmpogG0ZL55U7nHmDwuuumg5Hsjjd GJiRY9OMZY7W/XYwiO0FvQ8jil9Axrx27pyFeej3emi9f+XigGB81Igp8cWgfF6mI71esMlJ 5j7ia8jd56HBnAlCPy65zjTBdxjHe5pnIkjKo6k2Ffa40Dc7VcxLZvuX+9KK1wWh4S1bpXSd WHVKrnla5rmBKhHjLkV1BUsZuRti9ZJGbcfqBq0fblpgS/nxhCvgclLYIk7y09HD9UcegO2w 3+CNUfqFh5dL5aUUtMPpZ3fSKJMB2FffvtChPcHb21LtBIB5ryw6SHqonds9vaCaDgiqFCxa j8bA==
- Ironport-sdr: 5TD3GT5ZDzb8axULyBOFaU1woHobxXWN1sQrSwJSq6gKCkadtO5SiZkpVVR+QXDyWgQEw4KH4A Yv4QaMEkvjKww7IusSKKwvVHCvcrBY+ACGPEktCL5L8jML3W5/y+fuoCFEFEa2JsL1frgSDuto 45m0qTHor7tVZ1bCqWji0Q2ejozMI08RkFj2Liinrr/XZaSADO1wPyya/aGp0rqTw4h3cZ4KsM Yg6zzcym6eW1Xf8EdGqAnZgiFr20lQjfs5bVEzvXjwIzC8qT94TfODmMQU7QNjGyA8mlLIikZl 2SQ=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 18/06/2021 12:44, Jan Beulich wrote:
> On 18.06.2021 13:34, Andrew Cooper wrote:
>> On 18/06/2021 00:39, Daniel P. Smith wrote:
>>> @@ -197,16 +204,21 @@ bool __init has_xsm_magic(paddr_t start)
>>>
>>> int __init register_xsm(struct xsm_operations *ops)
>>> {
>>> - if ( verify(ops) )
>>> + if ( xsm_ops_registered != XSM_OPS_UNREGISTERED )
>>> + return -EAGAIN;
>> I know you moved this around the function, but it really isn't -EAGAIN
>> material any more. It's "too late - nope".
>>
>> -EEXIST is probably best for "I'm never going to tolerate another call".
>>
>>> +
>>> + if ( !ops )
>>> {
>>> - printk(XENLOG_ERR "Could not verify xsm_operations structure\n");
>>> + xsm_ops_registered = XSM_OPS_REG_FAILED;
>>> + printk(XENLOG_ERR "Invalid xsm_operations structure registered\n");
>>> return -EINVAL;
>> Honestly, I'd be half tempted to declare register_xsm() with
>> __nonnull(0) and let the compiler reject any attempt to pass a NULL ops
>> pointer.
>>
>> Both callers pass a pointer to a static singleton objects.
> Why check at all when the source of the arguments is all internal?
> We don't check pointers to be non-NULL elsewhere, with a few odd
> exceptions (which imo should all be dropped).
That too. At the end of my email, I suggested an alternative approach
which would remove register_xsm() entirely, and I think that is a
better-still way forward.
~Andrew
|