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 7822BC43334 for ; Fri, 15 Jul 2022 18:10:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.368453.599739 (Exim 4.92) (envelope-from ) id 1oCPlN-0002Ix-8H; Fri, 15 Jul 2022 18:10:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 368453.599739; Fri, 15 Jul 2022 18:10:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oCPlN-0002Iq-4z; Fri, 15 Jul 2022 18:10:05 +0000 Received: by outflank-mailman (input) for mailman id 368453; Fri, 15 Jul 2022 18:10:03 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oCPlL-00025E-Rw for xen-devel@lists.xenproject.org; Fri, 15 Jul 2022 18:10:03 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oCPlL-0002Un-Ii; Fri, 15 Jul 2022 18:10:03 +0000 Received: from [54.239.6.188] (helo=[192.168.17.116]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oCPlL-0002md-Bu; Fri, 15 Jul 2022 18:10:03 +0000 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=0dq+NPThF+RlX1bDPiXVFdfGt6qqMAkPqDf4Cr73lIk=; b=il5ytrRZ3EsxlBO41OJc62gmnJ KXWFyXBFomzzeeeyFQRc4VajTHf6KovzxTjDb/+AigIpFtbass/L5X9CBvkdxCPWCXxcEbo1VSuRB 5s3TmMNenn5ZDKJokLFBnMqTiVYflBcuc7ZxeWWZj94o/PCmGcoNY547EwxS1yspB+2Q=; Message-ID: Date: Fri, 15 Jul 2022 19:10:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v5 1/8] xen/arm: introduce static shared memory To: Penny Zheng , "xen-devel@lists.xenproject.org" Cc: Wei Chen , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk References: <20220620051114.210118-1-Penny.Zheng@arm.com> <20220620051114.210118-2-Penny.Zheng@arm.com> <45a41132-1520-a894-a9eb-6688c79a660d@xen.org> From: Julien Grall In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Penny, On 29/06/2022 09:39, Penny Zheng wrote: >>> + for ( i = 0; i < mem->nr_banks; i++ ) >>> + { >>> + /* >>> + * A static shared memory region could be shared between multiple >>> + * domains. >>> + */ >>> + if ( paddr == mem->bank[i].start && size == mem->bank[i].size ) >>> + break; > > Maybe I need to add a check on shm-id: > " > /* > * A static shared memory region could be shared between multiple > * domains. > */ > if ( strcmp(shm_id, mem->bank[i].shm_id) == 0 ) > { > if ( paddr == mem->bank[i].start && size == mem->bank[i].size ) > break; > else > { > printk("Warning: xen,shm-id %s does not match for all the nodes using the same region.\n", > shm_id); > return -EINVAL; > } > } > " > Wdyt? AFAICT, this would allow to region to overlap if they have different shm ID. I am not entirely sure the rest of your code would work properly in this case (what if the owner is different). So I think we need the following checks: 1) The shm ID matches *and* the region exactly match 2) The shm ID doesn't match and the region doesn't overlap with an existing one Cheers, -- Julien Grall