From patchwork Sun May 29 15:22:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 9139809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFDFF60755 for ; Sun, 29 May 2016 15:23:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4EA820265 for ; Sun, 29 May 2016 15:23:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97CC6281F9; Sun, 29 May 2016 15:23:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7392F20265 for ; Sun, 29 May 2016 15:23:00 +0000 (UTC) Received: from localhost ([::1]:56213 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b72YM-0006xH-GW for patchwork-qemu-devel@patchwork.kernel.org; Sun, 29 May 2016 11:22:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b72Y7-0006uX-CL for qemu-devel@nongnu.org; Sun, 29 May 2016 11:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b72Y3-0008BX-6i for qemu-devel@nongnu.org; Sun, 29 May 2016 11:22:42 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b72Y2-0008AW-HO for qemu-devel@nongnu.org; Sun, 29 May 2016 11:22:39 -0400 Received: by mail-wm0-x243.google.com with SMTP id a136so15064917wme.0 for ; Sun, 29 May 2016 08:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=wQ5rZ8ACLA+ZxM+8Q63+R+wiZuu8Ekb0SBGwBgGA46M=; b=Sm2bYHejyZywUPeZ22QhroLcHK1s59C4iW4ktxa1KUUds3L7KAtBIHfvcUkVK/cT2C KUPSDZ4w9WsAPSNEqJb1Q4wp4dljjyAhH7qiH+F1Hx2B/oF9f6Z3JYk4GKKmfVjZBdvc KG0nmzR1TxTMVgOrC8EY9sHSXIXgMxkeXVNv9g3IF7y2M3uOvRmvE8szC3ts4fDIhyT2 zw2gVLN3zREM72dpklvLY4jK97BfEnkf3teqo46orpE2Fqiuc/hRfR2T0SSFeAyv8O5B VYD0LL96mXwDR+wOt7l/biEtkSmXqxptY7pGh19iL+n5Ed3n+2mZqfp1MpEnMMaR5tMl p/og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=wQ5rZ8ACLA+ZxM+8Q63+R+wiZuu8Ekb0SBGwBgGA46M=; b=eBke6qG9mZYxejozNl6+o5kcQ9WgriKdwa8vqm8k3oXHr6ILoQwHg57HpUNyCRWvX1 G8lSHMzm7QRZ1p3djlOSLqVeqfyzVrdTCQfxb+7Magdmge/5awb1Y15hwcy8m7KrNpHK Tk8bj7hU0YLdsI8dERWO7dc2MTra08teiuL64/LL3CPGa77iO6V01ASeXqWWV5IqpD5g E1q1YG5hafLxlj6p9U+b7LCiO4Uka98hjvP2tRfScdab1vTDyTkxLH2334J+lqZXejFw nOCL9NJV/dwi7OmHGLEPdOW2XyBC0YSWa1laHSU9CTHrjn/w7fn7MSUN1ParKpOQO+rx 1XLg== X-Gm-Message-State: ALyK8tLLDI3A63YSf0ilt8S3JZJNQRPdZfOqvLN2SSkPMY4MVGcjBWGYcG4DQNM3QFl9FA== X-Received: by 10.28.138.13 with SMTP id m13mr7383061wmd.3.1464535357419; Sun, 29 May 2016 08:22:37 -0700 (PDT) Received: from dmitrys-mbp.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id c7sm29706618wji.38.2016.05.29.08.22.35 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 29 May 2016 08:22:36 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Dmitry Fleytman In-Reply-To: <5747C08C.9020104@redhat.com> Date: Sun, 29 May 2016 18:22:34 +0300 Message-Id: <540CF146-518B-40BA-86A3-5A7B1D89E6B4@daynix.com> References: <1464228995-26657-1-git-send-email-jasowang@redhat.com> <5747C08C.9020104@redhat.com> To: Peter Maydell X-Mailer: Apple Mail (2.3124) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: Re: [Qemu-devel] [PULL V3 00/20] Net patches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dmitry Fleytman , Jason Wang , Leonid Bloch , QEMU Developers Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP > On 27 May 2016, at 06:35 AM, Jason Wang wrote: > > > > On 2016年05月26日 23:08, Peter Maydell wrote: >> On 26 May 2016 at 03:16, Jason Wang wrote: >>> The following changes since commit 287db79df8af8e31f18e262feb5e05103a09e4d4: >>> >>> Merge remote-tracking branch 'remotes/ehabkost/tags/x86-pull-request' into staging (2016-05-24 13:06:33 +0100) >>> >>> are available in the git repository at: >>> >>> https://github.com/jasowang/qemu.git tags/net-pull-request >>> >>> for you to fetch changes up to 136796b070ddd09dd14ef73e77ae20419ba6554a: >>> >>> net/net: Add SocketReadState for reuse codes (2016-05-26 09:58:22 +0800) >>> >>> ---------------------------------------------------------------- >>> >>> Main changes: >>> - e1000e emulation >>> - convet vmxnet3 to use DMA api >>> Changes from V2: >>> - fix clang build >>> Changes from V1: >>> - fix 32bit build >> Hi. I'm afraid this introduces new errors in the clang sanitizer output >> from make check: all the check-qtest-i386 and check-qtest-x86_64 >> runs produce output like: >> >> /home/petmay01/linaro/qemu-for-merges/hw/pci/pcie.c:641:25: runtime >> error: left shift of 4092 by 20 places cannot be >> represented in type 'int' >> /home/petmay01/linaro/qemu-for-merges/hw/pci/pcie.c:642:45: runtime >> error: left shift of 4092 by 20 places cannot be >> represented in type 'int' >> ==14902==WARNING: Trying to symbolize code, but external symbolizer is >> not initialized! >> /home/petmay01/linaro/qemu-for-merges/include/qemu/bswap.h:120:1: >> runtime error: store to misaligned address 0x2b23c01e6674 for type >> 'uint64_t' (aka 'unsigned long'), which requires 8 byte alignment >> 0x2b23c01e6674: note: pointer points here >> 03 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >> 00 00 00 00 00 00 00 00 00 00 >> ^ > > Sorry for the trouble again. Wonder the correct way to enable sanitizer, after I add "-fsanitizer=address", it produces tons of warnings and errors but don't find the above outputs. > >> The stuff about left shifts is just the usual shift-into-sign-bit >> which we haven't yet sorted out what we're doing with (ie >> whether we can ignore them and shut up the sanitizer without >> silencing other interesting warnings), but we shouldn't be doing >> misaligned stores of 64-bit values. > > I agree. > >> >> Apologies for the lack of any backtraces in the output, but >> this is almost certainly the result of trying to do le64_to_cpu() >> or cpu_to_le64() on a buffer which isn't necessarily aligned >> (usually some pointer into guest memory). Use the functions >> ldq_le_p() and stq_le_p() instead, which will handle a >> potentially misaligned pointer for you. (There are similar >> functions for other access widths too.) >> >> thanks >> -- PMM > > Leonid and Dmitry, please check the guest memory access as suggested above and respin the series. I will hold the pull until the new version. Hi Peter, It turned out that the issue is not in the new code but in pci.h helper functions used by the new code to fill DSN capability. Following patch fixes the problem: pci_set_* pci_get_* functions except these two. Is there any specific reason you did not change these two functions then? Thanks, Dmitry > > Thanks > > diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index ef6ba51..ee238ad --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -468,13 +468,13 @@ pci_get_long(const uint8_t *config) static inline void pci_set_quad(uint8_t *config, uint64_t val) { - cpu_to_le64w((uint64_t *)config, val); + stq_le_p(config, val); } static inline uint64_t pci_get_quad(const uint8_t *config) { - return le64_to_cpup((const uint64_t *)config); + return ldq_le_p(config); } I see from git blame that some time ago you did similar change in all other