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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 50275C3DA59 for ; Mon, 22 Jul 2024 13:39:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.761959.1172030 (Exim 4.92) (envelope-from ) id 1sVtFP-0001nw-S5; Mon, 22 Jul 2024 13:38:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 761959.1172030; Mon, 22 Jul 2024 13:38:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sVtFP-0001np-Nw; Mon, 22 Jul 2024 13:38:39 +0000 Received: by outflank-mailman (input) for mailman id 761959; Mon, 22 Jul 2024 13:38:38 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sVtFO-0001ne-Ag for xen-devel@lists.xenproject.org; Mon, 22 Jul 2024 13:38:38 +0000 Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id afb3ed3d-482f-11ef-8776-851b0ebba9a2; Mon, 22 Jul 2024 15:38:33 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 2DED211400DE; Mon, 22 Jul 2024 09:38:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 22 Jul 2024 09:38:31 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Jul 2024 09:38:28 -0400 (EDT) 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: afb3ed3d-482f-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1721655511; x=1721741911; bh=jgQJxlvXDuS5mZp0nJOMfiNWvQE2RX0V+FJhfKM1XPg=; b= dzgoHv9zimFSlFsyAM4rGkfOFRKXi1Xnauko+2F1Zjfufm+uLQklUIvJkU+oopfT nWoPXucUehBFbDQ3w3F9a5I3jBEtC+C7hxlIhIAWShOVXj7+RDzALRryYUN5BWnw iKnMtJ+cXKihh8KsGByF8yrP9fZAR7URC5WqnyRfG0agIkCpNwwgqhUwTX8bu4Ct 7Q8UhGEMAZJhi4M8n9nKIJ9ypNh+8Hs0qbdmISgxOpQNQFXEKoNiAYGZNgdPiAZV y1cs80f+3OzHGMoQi5nI8sz0hylVyxTBsI0ZdmuPTCPvOucBb7+GOJuLBBqFKY/y TcB69IpmloicT6vtWeXC+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1721655511; x=1721741911; bh=jgQJxlvXDuS5mZp0nJOMfiNWvQE2 RX0V+FJhfKM1XPg=; b=id+JScuTnwNvyaphpar2XiaF7qhLw/MOJI+WsrF0ymNy pQnXqK2KEJw7gM37BEpXV8kpN7Pub0ZCAxPyb6lxRu3QTmkWAFsrS6hfLwG3+w/Y AgRvugI/+aQtNKGXB7KC3oxf3eg0+yguu/oUSJUCW22+uVdcLa9SkyZluGy++qfo JUIRcTG6hxLCvBn0uH06Q8YFLBFQHsgPAZExHDZzmnqdoMONdvEZupc9BvE6MYj6 tZ8OXCFIDMmtSO/u8FH1j13CzN2R4T+bGzOIl7Zaeiq0NM1XQV5mq+APSn1Nljos T+UXIP/IolCUBOdL2Zu4VCayoXHq/M82PyQJC9RsuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrheejgdeijecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeforghrvghk ucforghrtgiihihkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvh hishhisghlvghthhhinhhgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpefgudel teefvefhfeehieetleeihfejhfeludevteetkeevtedtvdegueetfeejudenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrmhgrrhgvkhes ihhnvhhishhisghlvghthhhinhhgshhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Date: Mon, 22 Jul 2024 15:38:25 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jan Beulich Cc: Andrew Cooper , Roger Pau =?utf-8?B?TW9ubsOp?= , xen-devel@lists.xenproject.org Subject: Re: [PATCH v5 2/3] x86/mm: add API for marking only part of a MMIO page read only Message-ID: References: <767482e3-3132-4a7f-81ba-6ce0ebea675e@suse.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/eDYpcvw0G/vQAOi" Content-Disposition: inline In-Reply-To: <767482e3-3132-4a7f-81ba-6ce0ebea675e@suse.com> --/eDYpcvw0G/vQAOi Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jul 2024 15:38:25 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Jan Beulich Cc: Andrew Cooper , Roger Pau =?utf-8?B?TW9ubsOp?= , xen-devel@lists.xenproject.org Subject: Re: [PATCH v5 2/3] x86/mm: add API for marking only part of a MMIO page read only On Mon, Jul 22, 2024 at 03:01:45PM +0200, Jan Beulich wrote: > On 22.07.2024 14:36, Marek Marczykowski-G=C3=B3recki wrote: > > On Mon, Jul 22, 2024 at 02:09:15PM +0200, Jan Beulich wrote: > >> On 19.07.2024 04:33, Marek Marczykowski-G=C3=B3recki wrote: > >>> +int __init subpage_mmio_ro_add( > >>> + paddr_t start, > >>> + size_t size) > >>> +{ > >>> + mfn_t mfn_start =3D maddr_to_mfn(start); > >>> + paddr_t end =3D start + size - 1; > >>> + mfn_t mfn_end =3D maddr_to_mfn(end); > >>> + unsigned int offset_end =3D 0; > >>> + int rc; > >>> + bool subpage_start, subpage_end; > >>> + > >>> + ASSERT(IS_ALIGNED(start, MMIO_RO_SUBPAGE_GRAN)); > >>> + ASSERT(IS_ALIGNED(size, MMIO_RO_SUBPAGE_GRAN)); > >>> + if ( !IS_ALIGNED(size, MMIO_RO_SUBPAGE_GRAN) ) > >>> + return -EINVAL; > >> > >> I think I had asked before: Why is misaligned size something that want= s a > >> release build fallback to the assertion, but not misaligned start? > >=20 > > Misaligned start will lead to protecting larger area, not smaller, so it > > is not unsafe thing to do. But I can also make it return an error, it > > shouldn't happen after all. >=20 > Well, I wouldn't mind if you kept what you have, just with a (brief) comm= ent > making clear why there is a difference in treatment. After all you could > treat mis-aligned size similarly, making the protected area larger, too. Ok. --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --/eDYpcvw0G/vQAOi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmaeYNIACgkQ24/THMrX 1yxAIgf8Da4R5SRZ7CHY7lPa9AeKiWCN4OzpejYHqYV0wqFSDcefTVlpSusAB0uo CiNuUWJPDGmrwOdGZtqZo+SeoK3iHf9CCGIFedwowCkNiqt3f53kUrx/g2lERMfJ bTAhoMFmcShOAbqWdawR/NXFPtWSyAzJ5+2S7sjUjy4CS5/kuD9Ek0k07Pfuhm5C JAn5sVWaEH/3SyrfEwpyrSbKt8px5wfr0tf39A7B6xXRaP+lXf/QbOeRuPJlJMNq ZoSttMDi2TYoF+DmFLcg4E0tnbEWYcYP/vfnElnO7mCWFlSHUn7UiGAgrIdpbcES n/J/bzWYO1Rj3jGzwYfAQDe1XosqCg== =2sNg -----END PGP SIGNATURE----- --/eDYpcvw0G/vQAOi--