From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eEhbnREV" 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-arm-msm@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); > + } 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C8B49C54E58 for ; Mon, 11 Mar 2024 05:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version: References:Message-ID:Subject:CC:To:From:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aOSY1VMxgKYg85hznED8C5cDES2cskRtePB7XxlHeO8=; b=3oYtIv5ZquBTEp RrX9ai7OCeUZ/JkSmLq5EYQWvK0+2d+iciJXD9kSPjjMznvUN7JwJgIvHmIRWdsZbz34vEZON+kA/ e4cph0Y6Gl+Ux5cLtvNIoym9OOOfViYSkHvYxEIktevluOLIxNzaUgMRDlQ1084X4L/R2M3/rRgUp 4N2YBukOCax8qEJfe8JIOtyQ45XLhTpxXFHT8vZ6DEJniVbLXcsFCs7zwJRfSGK09uLc/dAG6ueb4 hzkQrjYDoMXwy0ekherkEIO+3r2p4tL/88PUEzqHHtF1qapnnOix9yvqAgNPMW0wCH/ynbrHpZrF7 ntMcoW2uzmSBZMalZ2/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjYMz-00000000Gp1-2sca; Mon, 11 Mar 2024 05:38:41 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjYMw-00000000Gnn-35Ck for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 05:38:40 +0000 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> References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> X-Originating-IP: [10.80.80.8] 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240310_223838_915314_6FFCB20C X-CRM114-Status: GOOD ( 15.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Srivatsa Vaddagiri Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org * 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); > + } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel