Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp846055lqp; Sun, 14 Apr 2024 02:10:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzSsfebrLx/6b/zctdHKIrb6W3+5T5KRY39zz14mmVe+3OUXZiulNes3om+MOqoiyRG38SH31HkDU6mKegJLv6pxq6UW97YhXIx5MQSQ== X-Google-Smtp-Source: AGHT+IH8mhnWxuMPc3MNSd1nSyzHdxkN4ZafMByC/sZpXzhsJQfGcYZFFebsob5vOZhuWXnJi5qv X-Received: by 2002:ac8:570a:0:b0:436:b95c:e7b4 with SMTP id 10-20020ac8570a000000b00436b95ce7b4mr4240569qtw.47.1713085800530; Sun, 14 Apr 2024 02:10:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713085800; cv=pass; d=google.com; s=arc-20160816; b=WkYYj+f1/e5oS5HfUCPOGw/vOq3l2FdnBJS6n6ZiuNwBwrPs0Jfe3/oAh7wtKiwhrq UI+V/J1001umyRLyWnWHHutFVn02z24EvO6VjQn0doBvzG+UBmBshuia+nAJFpDaB0Ur d4H31f40gFU3hXyMZnX65KitJNN3ABmnb5yAOXz+5kXFbm+ltrahnth1lLj43DZoAEop sLR35a0uWr/n1mZ1BRJhkEKkLzIcI9F19M5jLKiPQK9wh9ZvP/N2k4NlEUnN5AykkVNn p+J6kxvZ6Pj9fQTdSGZHpTAMd9eAPldg75gV3RpruGj2gX99OyczWUutOOcT0CCm4lq1 JyJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KDn9p0oKJIowoxHQ+QZq8N5Xvgpd2J6FJtOvcnaAQTg=; fh=JewBCH2JhVfbVQhu4LggCDs0QkAEJh5or7ZkUSWxRJg=; b=s7ppIyLavPc/WOA/jhmveJ8b+Fa0iCsQTtPZ8p9+LjxsZC6P8Kwwr+K8cAVuOlLCtP u+Ol4ZlZYHq9xxxrn2Ulav8cPjnte9m96YfQUd5nTgba1UMc6PZgT25unYxBKMrEM1/B nwsu4gjVuDoZL1L6q3yP/1yc2Z7BQ7goE0sCN4+el00uuY6NX4Mf8fBUcZ8vwXvUg7m3 5+VVzn9kD7TeHyvxbV8BVOdmnVHGJQZ0KspQoie9m5nCXq1yrkXR/O1O8z4gKSwigTOa Q5J3JN0l3vZzeOjB9CVkAKMUp8R7LgTEsv9iur1nbjhu1fNQC4i8JCJWinis1U6wO999 W3Pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cTDvmFLu; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-144067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c19-20020ac87dd3000000b004363f54f392si8052641qte.731.2024.04.14.02.10.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 02:10:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cTDvmFLu; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-144067-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144067-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 466A31C20E80 for ; Sun, 14 Apr 2024 09:10:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 518A323763; Sun, 14 Apr 2024 09:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cTDvmFLu" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 4E2A0225D4 for ; Sun, 14 Apr 2024 09:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713085788; cv=none; b=iQ2Se69aigCkl1Y1MdC9eCa6j3kaf1qU3c4AYyTwYF4wdPWEtgJXeorWnvelWS5zT+gyLg7XRAWIjxcwN1I2ruLFa6+xh2V87Ae6aS1/6hGF3kVlD5yvPb3Z6AR/3wdVcax/nyMN6d2rQsxxr5Os/DknYlS3sNkGrC16vXnBe/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713085788; c=relaxed/simple; bh=mx81azu7WGqDtDaPoKpPXOlm5ztzVujTkyngWrhVR+Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jE/4fa5G/kZNmORslBPPopmgCTz8TFAler60CsUxTpZRikrAM+OtWw3q0AtqbDLlFrZoqDDgNWxNEw5mo25ZF/6s8v/GXYlEgV0111wP5Ii40Sn9jy+bochcm5qXnbawQriLXTm5KBFYCnTVZGslyFundx2TXOS0efdEZ8pM4Gw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cTDvmFLu; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713085785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KDn9p0oKJIowoxHQ+QZq8N5Xvgpd2J6FJtOvcnaAQTg=; b=cTDvmFLucsv6BAwvVTWGcaWjPl7jBhSdEmsipvS2uuXlIf5lYiHgBWwHQn8kQwdS3DUZLo SQkvspX7IXon7VqjeWXnL5pnImbG6VzQReMQY+IBpiHBe39OzwHNZyr0jzc0vwThgr5yf9 MTw+tbfvH/1ZYV27eOfeMcnrmiFOgGA= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-wJGPThGIO8CMLLqv5D1U4w-1; Sun, 14 Apr 2024 05:09:43 -0400 X-MC-Unique: wJGPThGIO8CMLLqv5D1U4w-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d84af71cddso15450491fa.0 for ; Sun, 14 Apr 2024 02:09:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713085782; x=1713690582; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KDn9p0oKJIowoxHQ+QZq8N5Xvgpd2J6FJtOvcnaAQTg=; b=hxgOuvg2g4jzPhGw93YbVY3G2YbMAC0jpMiUQvvQAuX9YPIscBGHZpp8YqQnHSIIN9 cThTJjuv7KrduoSTQRN6fRgOUuLRv4WJJJkPmdxyO1GRtSGRBJO0p3+U+K4fk3FxLd5w NG94pm3x+BJ+C5CcPo25iAUEG9qmlPGfOVrpGmyUsUj7/YlIkeGgaOEXtH8pwLprk/A5 uzvqJkeIZihRulHGGbmZx5y+JJhvI5Imb39oYww3DDjQHQe/a8r4BbkQXB3VSklAaRae Q3ID/lOmNnz+xmSi776DB9O0KWsg7UrlTTy88gZ1eCJkUmLhElyR/M7yHT0lflgPaPDa 4nMg== X-Forwarded-Encrypted: i=1; AJvYcCUo6SqBOHgTIYVR18Z7qRQgGz4+uzejLlzxkFUG98xX1vCKSkUlM4vGwalUY3F1Vd8jjGo/Mocfi8smkiffjORpsuNJUL2XtaY9NmvD X-Gm-Message-State: AOJu0YxFwlO+0EA1Nqmr1U1xAf1txNfUOg43TGmdZP6jLD1rHyGjDLMw d05rY5DZTFGTiDVTQYoho+ncw8O8LCotuTDXEZL9iMAVhXEo/R6prtMOY+Icux+3PExvcP5w1L+ XVg9+XAiXqW8bR/WBMnHSBWcQ5mclIIJc11cxRXwYhDhp6EFwhD1Ak1li/aT6Kw== X-Received: by 2002:a2e:3509:0:b0:2d9:ecc1:6d56 with SMTP id z9-20020a2e3509000000b002d9ecc16d56mr4549910ljz.11.1713085782023; Sun, 14 Apr 2024 02:09:42 -0700 (PDT) X-Received: by 2002:a2e:3509:0:b0:2d9:ecc1:6d56 with SMTP id z9-20020a2e3509000000b002d9ecc16d56mr4549901ljz.11.1713085781463; Sun, 14 Apr 2024 02:09:41 -0700 (PDT) Received: from redhat.com ([31.187.78.68]) by smtp.gmail.com with ESMTPSA id u2-20020a05600c4d0200b0041668053ca9sm10311768wmp.0.2024.04.14.02.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 02:09:40 -0700 (PDT) Date: Sun, 14 Apr 2024 05:09:38 -0400 From: "Michael S. Tsirkin" To: Christophe JAILLET Cc: Jason Wang , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org Subject: Re: [PATCH] vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API Message-ID: <20240414050922-mutt-send-email-mst@kernel.org> References: <20240414043334-mutt-send-email-mst@kernel.org> 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 Content-Transfer-Encoding: 8bit In-Reply-To: On Sun, Apr 14, 2024 at 10:59:06AM +0200, Christophe JAILLET wrote: > Le 14/04/2024 ? 10:35, Michael S. Tsirkin a ?crit?: > > On Mon, Jan 15, 2024 at 09:35:50PM +0100, Christophe JAILLET wrote: > > > ida_alloc() and ida_free() should be preferred to the deprecated > > > ida_simple_get() and ida_simple_remove(). > > > > > > Note that the upper limit of ida_simple_get() is exclusive, buInputt the one of > > > > What's buInputt? But? > > Yes, sorry. It is "but". > > Let me know if I should send a v2, or if it can be fixed when it is applied. > > CJ Yes it's easier if you do. Thanks! > > > > > ida_alloc_max() is inclusive. So a -1 has been added when needed. > > > > > > Signed-off-by: Christophe JAILLET > > > > > > Jason, wanna ack? > > > > > --- > > > drivers/vhost/vdpa.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > > > index bc4a51e4638b..849b9d2dd51f 100644 > > > --- a/drivers/vhost/vdpa.c > > > +++ b/drivers/vhost/vdpa.c > > > @@ -1534,7 +1534,7 @@ static void vhost_vdpa_release_dev(struct device *device) > > > struct vhost_vdpa *v = > > > container_of(device, struct vhost_vdpa, dev); > > > - ida_simple_remove(&vhost_vdpa_ida, v->minor); > > > + ida_free(&vhost_vdpa_ida, v->minor); > > > kfree(v->vqs); > > > kfree(v); > > > } > > > @@ -1557,8 +1557,8 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa) > > > if (!v) > > > return -ENOMEM; > > > - minor = ida_simple_get(&vhost_vdpa_ida, 0, > > > - VHOST_VDPA_DEV_MAX, GFP_KERNEL); > > > + minor = ida_alloc_max(&vhost_vdpa_ida, VHOST_VDPA_DEV_MAX - 1, > > > + GFP_KERNEL); > > > if (minor < 0) { > > > kfree(v); > > > return minor; > > > -- > > > 2.43.0 > > > > > >