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=-10.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 55FBFC4742C for ; Mon, 16 Nov 2020 11:38:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FA40221F8 for ; Mon, 16 Nov 2020 11:38:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DuGQ7+di" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FA40221F8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kecpk-0003km-Lv for qemu-devel@archiver.kernel.org; Mon, 16 Nov 2020 06:38:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kecoe-0002iH-N3; Mon, 16 Nov 2020 06:37:00 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:35495) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kecod-00037W-1t; Mon, 16 Nov 2020 06:37:00 -0500 Received: by mail-pf1-x443.google.com with SMTP id g7so13861077pfc.2; Mon, 16 Nov 2020 03:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UFH0+ELaVXot65Bga4ikUSfjxiAfE4dM8vvDQqab7tc=; b=DuGQ7+di8x0M5ZFHeT4I6yAUZA79QEzUg8Ovrf4/UmzKMACKOYB06sAB8fdehz/wZ6 xEO5KMXn3MUM6RYVaD127DIG6NSyubjGebdo/VT8U3qPYj/v+kMamFuZ5UKWGwwmVs5K feho5rDvi/E6/WTvgWg5XxtixZBK2htcYDMokmHmEcSxCErUw1T+WQJPzIZsq9CwSuRh wy7V2mCwhytLgExErvCx+c2ZEqL6BozFDOrFDLApfmCSUPnpMW5LungNuTkjbw+CltTE 7Te4Wdt1XPe8EVaBJanG32eCmIZRMn0mcCyD4WCpBDv1c5Hopi00Os0dqWoBR+qBCpUL 3ZVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UFH0+ELaVXot65Bga4ikUSfjxiAfE4dM8vvDQqab7tc=; b=IvFgFk20mpclumOFG1UxYNi+wgNxnKt6jIloR+UOl9F63uRoxWvn6JdvoucmCBuHhG Jgmjfu7d4DdsAqI1/A/q/7r12lx7LG3pDMawtTLNaWxQG67mMl7X8UPUOik1adJ1gtXk cCPyGDiB+LzFQra47p001TzqTNBGeR4+TAJtY42np65V+/EC5oRd4FpYHAs0T+R8W3TY VGHhqsZ8IGwy5tvhKB6ZTQAIqnP0cXMSPJ3FxMSGpSx8YGoSn5P7NABvhKYVPZRfQ9Nm F5hRmUTx+mKBa6F76pQ4AuQGKMSEORuGp5ozl/5UNnRnN2UFkg30IRxssqszOP4CSDj/ xDHw== X-Gm-Message-State: AOAM533fSUHFIzuGQTC/r+YZem0Opks/DcAZTe+ihZF/XoENEiimMuEQ q9xvxZCtGDeP3K3R9orBR74= X-Google-Smtp-Source: ABdhPJyK1NiAHMcuXHLWPS5FV+dy1AmJB87S1tGsaE97vIrctafoVoRGeP5ZzVIIgo9raxd9dL1npw== X-Received: by 2002:a17:90a:cb05:: with SMTP id z5mr15857414pjt.216.1605526617247; Mon, 16 Nov 2020 03:36:57 -0800 (PST) Received: from localhost ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id w6sm15131558pgr.71.2020.11.16.03.36.56 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Nov 2020 03:36:56 -0800 (PST) Date: Mon, 16 Nov 2020 20:36:54 +0900 From: Minwoo Im To: Klaus Jensen Subject: Re: [PATCH v8 2/5] hw/block/nvme: pull aio error handling Message-ID: <20201116113654.GB7308@localhost.localdomain> References: <20201112195945.819915-1-its@irrelevant.dk> <20201112195945.819915-3-its@irrelevant.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20201112195945.819915-3-its@irrelevant.dk> User-Agent: Mutt/1.11.4 (2019-03-13) Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pf1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Klaus Jensen , qemu-devel@nongnu.org, Max Reitz , Keith Busch , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 11/12 20:59, Klaus Jensen wrote: > From: Klaus Jensen > > Add a new function, nvme_aio_err, to handle errors resulting from AIOs > and use this from the callbacks. > > Signed-off-by: Klaus Jensen > --- > hw/block/nvme.c | 61 +++++++++++++++++++++++++++++-------------------- > 1 file changed, 36 insertions(+), 25 deletions(-) > > diff --git a/hw/block/nvme.c b/hw/block/nvme.c > index 51f35e8cf18b..a96a996ddc0d 100644 > --- a/hw/block/nvme.c > +++ b/hw/block/nvme.c > @@ -878,6 +878,41 @@ static inline uint16_t nvme_check_bounds(NvmeNamespace *ns, uint64_t slba, > return NVME_SUCCESS; > } > > +static void nvme_aio_err(NvmeRequest *req, int ret) > +{ > + uint16_t status = NVME_SUCCESS; > + Error *local_err = NULL; > + > + switch (req->cmd.opcode) { > + case NVME_CMD_READ: > + status = NVME_UNRECOVERED_READ; > + break; > + case NVME_CMD_FLUSH: > + case NVME_CMD_WRITE: > + case NVME_CMD_WRITE_ZEROES: > + status = NVME_WRITE_FAULT; > + break; > + default: > + status = NVME_INTERNAL_DEV_ERROR; > + break; > + } > + > + trace_pci_nvme_err_aio(nvme_cid(req), strerror(ret), status); > + > + error_setg_errno(&local_err, -ret, "aio failed"); > + error_report_err(local_err); > + > + /* > + * Set the command status code to the first encountered error but allow a > + * subsequent Internal Device Error to trump it. > + */ > + if (req->status && status != NVME_INTERNAL_DEV_ERROR) { > + return; > + } Are we okay with the trace print up there in case that this if is taken? I guess if this if is taken, the trace print may not that matter.