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 X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A30C38A24 for ; Thu, 7 May 2020 10:33:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C0C6208E4 for ; Thu, 7 May 2020 10:33:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T70DOvut" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727902AbgEGKdw (ORCPT ); Thu, 7 May 2020 06:33:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20056 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727871AbgEGKdi (ORCPT ); Thu, 7 May 2020 06:33:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588847617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IMpKC+WaqGZDsc1g0rXogIX0QesvRk4Fl/dqbsUcG6U=; b=T70DOvut3+MhplrA4XVjUKKYISEkX8H5JPDylhhf8wxVwgfiOezdVRm0UHu0E+twYuf405 SMwKM2J8EgUx2zU4Bd+TdINtJ80n3knR0Ax3nsA4ZqVvpgXXc1JDJdZiNmpbQt7fUVwMhs cdnrAAdd32CaS5M3WpZTEV/XpcB4Zx0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-Rd-9UwcXMkuTVi-LBsv7Cg-1; Thu, 07 May 2020 06:33:33 -0400 X-MC-Unique: Rd-9UwcXMkuTVi-LBsv7Cg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30625872FE0; Thu, 7 May 2020 10:33:32 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-245.ams2.redhat.com [10.36.113.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30DFF5D9C5; Thu, 7 May 2020 10:33:30 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, virtio-dev@lists.oasis-open.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, Michal Hocko , Andrew Morton , "Michael S . Tsirkin" , David Hildenbrand , Pankaj Gupta Subject: [PATCH v3 14/15] virtio-mem: Use -ETXTBSY as error code if the device is busy Date: Thu, 7 May 2020 12:31:18 +0200 Message-Id: <20200507103119.11219-15-david@redhat.com> In-Reply-To: <20200507103119.11219-1-david@redhat.com> References: <20200507103119.11219-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's be able to distinguish if the device or if memory is busy. Cc: "Michael S. Tsirkin" Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index a719e1a04ac7..abd93b778a26 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -893,7 +893,7 @@ static int virtio_mem_send_plug_request(struct virtio= _mem *vm, uint64_t addr, case VIRTIO_MEM_RESP_NACK: return -EAGAIN; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; case VIRTIO_MEM_RESP_ERROR: return -EINVAL; default: @@ -919,7 +919,7 @@ static int virtio_mem_send_unplug_request(struct virt= io_mem *vm, uint64_t addr, vm->plugged_size -=3D size; return 0; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; case VIRTIO_MEM_RESP_ERROR: return -EINVAL; default: @@ -941,7 +941,7 @@ static int virtio_mem_send_unplug_all_request(struct = virtio_mem *vm) atomic_set(&vm->config_changed, 1); return 0; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; default: return -ENOMEM; } @@ -1557,11 +1557,15 @@ static void virtio_mem_run_wq(struct work_struct = *work) * or we have too many offline memory blocks. */ break; - case -EBUSY: + case -ETXTBSY: /* * The hypervisor cannot process our request right now - * (e.g., out of memory, migrating) or we cannot free up - * any memory to unplug it (all plugged memory is busy). + * (e.g., out of memory, migrating); + */ + case -EBUSY: + /* + * We cannot free up any memory to unplug it (all plugged memory + * is busy). */ case -ENOMEM: /* Out of memory, try again later. */ --=20 2.25.3 From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: [PATCH v3 14/15] virtio-mem: Use -ETXTBSY as error code if the device is busy Date: Thu, 7 May 2020 12:31:18 +0200 Message-ID: <20200507103119.11219-15-david@redhat.com> References: <20200507103119.11219-1-david@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200507103119.11219-1-david@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" To: linux-kernel@vger.kernel.org Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, "Michael S . Tsirkin" , Michal Hocko , linux-mm@kvack.org, Pankaj Gupta , Andrew Morton , virtualization@lists.linux-foundation.org List-Id: virtualization@lists.linuxfoundation.org Let's be able to distinguish if the device or if memory is busy. Cc: "Michael S. Tsirkin" Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index a719e1a04ac7..abd93b778a26 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -893,7 +893,7 @@ static int virtio_mem_send_plug_request(struct virtio_mem *vm, uint64_t addr, case VIRTIO_MEM_RESP_NACK: return -EAGAIN; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; case VIRTIO_MEM_RESP_ERROR: return -EINVAL; default: @@ -919,7 +919,7 @@ static int virtio_mem_send_unplug_request(struct virtio_mem *vm, uint64_t addr, vm->plugged_size -= size; return 0; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; case VIRTIO_MEM_RESP_ERROR: return -EINVAL; default: @@ -941,7 +941,7 @@ static int virtio_mem_send_unplug_all_request(struct virtio_mem *vm) atomic_set(&vm->config_changed, 1); return 0; case VIRTIO_MEM_RESP_BUSY: - return -EBUSY; + return -ETXTBSY; default: return -ENOMEM; } @@ -1557,11 +1557,15 @@ static void virtio_mem_run_wq(struct work_struct *work) * or we have too many offline memory blocks. */ break; - case -EBUSY: + case -ETXTBSY: /* * The hypervisor cannot process our request right now - * (e.g., out of memory, migrating) or we cannot free up - * any memory to unplug it (all plugged memory is busy). + * (e.g., out of memory, migrating); + */ + case -EBUSY: + /* + * We cannot free up any memory to unplug it (all plugged memory + * is busy). */ case -ENOMEM: /* Out of memory, try again later. */ -- 2.25.3 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-7253-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 48A82985EA3 for ; Thu, 7 May 2020 10:33:38 +0000 (UTC) From: David Hildenbrand Date: Thu, 7 May 2020 12:31:18 +0200 Message-Id: <20200507103119.11219-15-david@redhat.com> In-Reply-To: <20200507103119.11219-1-david@redhat.com> References: <20200507103119.11219-1-david@redhat.com> MIME-Version: 1.0 Subject: [virtio-dev] [PATCH v3 14/15] virtio-mem: Use -ETXTBSY as error code if the device is busy Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, virtio-dev@lists.oasis-open.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, Michal Hocko , Andrew Morton , "Michael S . Tsirkin" , David Hildenbrand , Pankaj Gupta List-ID: Let's be able to distinguish if the device or if memory is busy. Cc: "Michael S. Tsirkin" Cc: Pankaj Gupta Signed-off-by: David Hildenbrand --- drivers/virtio/virtio_mem.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c index a719e1a04ac7..abd93b778a26 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -893,7 +893,7 @@ static int virtio_mem_send_plug_request(struct virtio_m= em *vm, uint64_t addr, =09case VIRTIO_MEM_RESP_NACK: =09=09return -EAGAIN; =09case VIRTIO_MEM_RESP_BUSY: -=09=09return -EBUSY; +=09=09return -ETXTBSY; =09case VIRTIO_MEM_RESP_ERROR: =09=09return -EINVAL; =09default: @@ -919,7 +919,7 @@ static int virtio_mem_send_unplug_request(struct virtio= _mem *vm, uint64_t addr, =09=09vm->plugged_size -=3D size; =09=09return 0; =09case VIRTIO_MEM_RESP_BUSY: -=09=09return -EBUSY; +=09=09return -ETXTBSY; =09case VIRTIO_MEM_RESP_ERROR: =09=09return -EINVAL; =09default: @@ -941,7 +941,7 @@ static int virtio_mem_send_unplug_all_request(struct vi= rtio_mem *vm) =09=09atomic_set(&vm->config_changed, 1); =09=09return 0; =09case VIRTIO_MEM_RESP_BUSY: -=09=09return -EBUSY; +=09=09return -ETXTBSY; =09default: =09=09return -ENOMEM; =09} @@ -1557,11 +1557,15 @@ static void virtio_mem_run_wq(struct work_struct *w= ork) =09=09 * or we have too many offline memory blocks. =09=09 */ =09=09break; -=09case -EBUSY: +=09case -ETXTBSY: =09=09/* =09=09 * The hypervisor cannot process our request right now -=09=09 * (e.g., out of memory, migrating) or we cannot free up -=09=09 * any memory to unplug it (all plugged memory is busy). +=09=09 * (e.g., out of memory, migrating); +=09=09 */ +=09case -EBUSY: +=09=09/* +=09=09 * We cannot free up any memory to unplug it (all plugged memory +=09=09 * is busy). =09=09 */ =09case -ENOMEM: =09=09/* Out of memory, try again later. */ --=20 2.25.3 --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org