Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp204509lql; Sun, 10 Mar 2024 22:38:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUYJat73j/cJsc9SKdUwhIVjuGHFcYIQcZpOxMwBXJWzoJEYkNgergL42bj3xL1fVCrsrRsuanCsebW2Fyeete9XXS42hYvBL5mRQaNjw== X-Google-Smtp-Source: AGHT+IGl7hYcHmfhB69PAMbvpzPNGC28z5TgreIf3IDLVrv0ToAB7glpHFu9HdZY01RO1Hb6hkWI X-Received: by 2002:a05:6a21:3482:b0:1a3:f46:853e with SMTP id yo2-20020a056a21348200b001a30f46853emr2899308pzb.60.1710135538415; Sun, 10 Mar 2024 22:38:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710135538; cv=pass; d=google.com; s=arc-20160816; b=W8qMjTnO53Ioo8IxedLyjybvvrnKE37rxTMPSNxQR15JklHD1qYUt+Ofs70TIxL8tv fO2NOI7jReKZ12uZM16QLBRGztkvYm2xwIw+JiFiMxWgw3oQv5hce3nSUFRdMmwwU0aY dBLsqfszFtPvq7mp1ERBDbeJc4qBe6ZvkvPsYksyJnpCSpNB+f/+YgXFK7gN7HdNgHCv yfJNHpJJSsTxqTpIEKNV1k0N27kTQZdZq9k0fDY0+41/OH28+C/ugSzVraTQNbySetWg tRs75a6LWoqVimpMLIuC6Ihp7YB/EjAz+2tnJlFiywzmwYzaXwsl3zEk2BhOqlq6uVm9 cCBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ddYhWpZ6UFYa7XqP0w1UUiujo7MlM6KsRadAKbQ22Rw=; fh=Dml0xr6W9m0eGxCVz87SMG/89fyh4zMd52MRT1Yqxt4=; b=nRMqpPDMctOComByGNuA8RQEFG+jH6MtTTw51CYihkzs6l3mSvilBMOSix4T9l/2GJ qNMZM1pG66SqAKBNFf3QNp9S/BP8LXP9D6IjG62Q9yexBj6PcrtrtWjgOPcxs6SVWk88 yUxOCphgoA4uJgo0Yv5pQqLnUtnzDYqABHwIdundTRQwKKkQ8aWYd/7DyQclULpLRSh4 GKxUdwQLHc3u+8tZV99btusaEVS6/NUH5aUIbm/gyvx0Nr8U+p5d9dUIsIsIovLqKDIE 47nUZFADb54UjOW0aG+ELoJt41OspKaCXA+VKlGcozJHlbNSPRx6hfF6pwbi6MxeN/Io cDTg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eEhbnREV; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-98482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s11-20020a17090a948b00b0029b77c1d3ecsi4363710pjo.16.2024.03.10.22.38.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 22:38:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eEhbnREV; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-98482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 800B9B20D7D for ; Mon, 11 Mar 2024 05:38:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BBC7CA50; Mon, 11 Mar 2024 05:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eEhbnREV" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF029748E; Mon, 11 Mar 2024 05:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710135524; cv=none; b=dkdzyJXLZvLL1EUBYSXuDPXL75joQTYV0fj3vCf9NNSE2xBKyUkAYHXFEQmtximZv6XWYQ7c0d9kAY5r5Fm3FttJjQ3kzSSVTrLkACfH1ReK9AK0wF+OIci9WXr8bCVNY/DIXgw/Bc2zUr6Rj00rgS/BQkpX+1imQEVr6F8vS1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710135524; c=relaxed/simple; bh=JkYYh47/8McwjllgWCKNB4oAhTTgDeqPKIVJmU8Vpyo=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NzHBjHrd6ZrgiSAvanbe0W8Q45Du5NNIQ+bKElQITSMJnzCyhrX0Iv0j8X1tn3Jv7Q4cgw7ls6f1cWL3oUSy7/363YqZH63J6XFDx7pBbBs/33iaXr+JgQ+3+CKQY759r8P9jhGiMK2vfzJ7FvALkIcYtRuIJ0X1axat6u8lZKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eEhbnREV; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42B5J5MF003578; Mon, 11 Mar 2024 05:38:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:reply-to:references :mime-version:content-type:in-reply-to; s=qcppdkim1; bh=ddYhWpZ6 UFYa7XqP0w1UUiujo7MlM6KsRadAKbQ22Rw=; b=eEhbnREV5Wa3zXvIJZx+lqnS anX5OBKzDgYK8YL2a9FZsSpKCT+rvAk7E5B4fgcg50OjuQOWEKY7F7beXLUDB5K7 3dUgPq6x93l8cN/khCTxxdryGgFyKuy2qOIkr4RDAsa4nAzTTHY4nAbD6ZD1ayCF qEtqsVESmgxfylmOleSjdphQc3BEW1l0ogVwllLgYEtmPei+TYlJg4lSA1yaoRnz XxbFaWA/ddpvyTm94jLZEgOPt/N0SjetgA4mhW4LyODsq53ZmzQX0pIHkL6Lwr2n 5DqzbTNLj2M4HeD1PalYjXKTOV1+BvRhIcPdb3x93kIb9o62cOy/lWmDhLqywg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wresbtsmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:38:19 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42B5cI2M007024 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 05:38:18 GMT Received: from quicinc.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Sun, 10 Mar 2024 22:38:10 -0700 Date: Mon, 11 Mar 2024 11:08:06 +0530 From: Srivatsa Vaddagiri To: Elliot Berman CC: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" , , , , , , Subject: Re: [PATCH v17 12/35] virt: gunyah: Add resource tickets Message-ID: <20240311053806.GL440762@quicinc.com> Reply-To: Srivatsa Vaddagiri References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline In-Reply-To: <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ZEy7XYUtlKeA49q6fTfq0MIjfbi1DK-L X-Proofpoint-GUID: ZEy7XYUtlKeA49q6fTfq0MIjfbi1DK-L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_02,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 mlxscore=0 adultscore=0 clxscore=1011 malwarescore=0 spamscore=0 suspectscore=0 mlxlogscore=860 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403110041 * Elliot Berman [2024-02-22 15:16:35]: > Gunyah doesn't process the label and that makes it > possible for userspace to create multiple resources with the same label. I think that description conflicts with what is implemented in this patch? int gunyah_vm_add_resource_ticket(struct gunyah_vm *ghvm, struct gunyah_vm_resource_ticket *ticket) { mutex_lock(&ghvm->resources_lock); list_for_each_entry(iter, &ghvm->resource_tickets, vm_list) { if (iter->resource_type == ticket->resource_type && iter->label == ticket->label) { ret = -EEXIST; goto out; } } // > @@ -134,6 +246,25 @@ static int gunyah_vm_start(struct gunyah_vm *ghvm) > } > ghvm->vm_status = GUNYAH_RM_VM_STATUS_READY; > > + ret = gunyah_rm_get_hyp_resources(ghvm->rm, ghvm->vmid, &resources); > + if (ret) { > + dev_warn(ghvm->parent, > + "Failed to get hypervisor resources for VM: %d\n", > + ret); > + goto err; > + } Where do we free memory pointed by 'resources' ptr? > + > + for (i = 0, n = le32_to_cpu(resources->n_entries); i < n; i++) { > + ghrsc = gunyah_rm_alloc_resource(ghvm->rm, > + &resources->entries[i]); > + if (!ghrsc) { > + ret = -ENOMEM; > + goto err; > + } > + > + gunyah_vm_add_resource(ghvm, ghrsc); > + }