Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp612894ybj; Thu, 7 May 2020 03:36:20 -0700 (PDT) X-Google-Smtp-Source: APiQypL797QkyXUQaV4/jEBIQm5eNQQGOrqDeS5Z9k3L7dk1cSU8L0s/kUBisoBRltVvAFU8FAN1 X-Received: by 2002:aa7:d0c2:: with SMTP id u2mr11553849edo.78.1588847780313; Thu, 07 May 2020 03:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588847780; cv=none; d=google.com; s=arc-20160816; b=Wm/iIodc2COG8z2QP+MqQ1UBT01mmqbFAVzxMI9v3XS3Rhh/Aa00KQo/K1jElGJ8Zc jCCf4fUP3LzHJ2ibHYUdI6HavU80hvu679kRlCLnyW8382geo0nd8BG+UGKzgLh/goAi E1ABc2PQ1e/b77Vr6RNmF39pgxrI4pkkH7JeI1FOCOKOZ7jpo5WssQftNlx4PKVg/gTg 0+C9bX6E6uEJf2vBCRA1unFDHcjxe10d7Cum+zIG217D1ZmV8psBNFe+IB1TXMGUeLr6 WzdIq9oCCsggi38m/ExP3fujVuIVn15ilW/arUB44u5Kv/xSEOzztorJxy10GJOJicYd nJJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IMpKC+WaqGZDsc1g0rXogIX0QesvRk4Fl/dqbsUcG6U=; b=foLOTXW9xSTLfNzlMKJwHo2Af5zTTwJGXg8bQsK4NG7whrpr2vvxIRrdgwuBT06aFT RIuReRuehkioHgfIQkRVZbbaPLRmGSgTIbUScLOSk7Gqlx0iRPsg7vuVoICWsqXc6Rv0 fr4qIdFik2WOQnL/a7l+GvHIwTip9DG3CtTqG1oRwYeOKMXlYwFQ0HtRbO3GRZifnN1D AtIff/82H+d6eaEJ1JRpkcHdkMOoEuLqL/QqeOj+wZUr+FmZgYKUBVp+2qs3xGL3mIkM 224OlNJ/Y34bHncz1JlwAYP5q+N5Em/DYoBMQjLobewJ+E+lcjQWifJhE4+dyZ0yRS+T 5N+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T70DOvut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o26si2138378eja.150.2020.05.07.03.35.56; Thu, 07 May 2020 03:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T70DOvut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727878AbgEGKdv (ORCPT + 99 others); Thu, 7 May 2020 06:33:51 -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