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=-4.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 09C0DC47091 for ; Sun, 30 May 2021 06:46:42 +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 80CA860FDA for ; Sun, 30 May 2021 06:46:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80CA860FDA 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]:45092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnFDc-0005d2-Hj for qemu-devel@archiver.kernel.org; Sun, 30 May 2021 02:46:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnFBt-0004mV-MJ for qemu-devel@nongnu.org; Sun, 30 May 2021 02:44:53 -0400 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]:45652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnFBs-0008Vd-0y for qemu-devel@nongnu.org; Sun, 30 May 2021 02:44:53 -0400 Received: by mail-io1-xd35.google.com with SMTP id a8so8655780ioa.12 for ; Sat, 29 May 2021 23:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mgwShcemOtX0BVy1q/tyuiadVzWUjcA0MZ7ig1eIS5A=; b=SONH6tJ/fiEla5CRRc4grMQ2Qf1af+AvrtCfl2gIQHddLo2IiCM75syQI+qmlCKEOP +OWE71pYwhyh7SmyFQqwiHBSl1/ugI5FkUGd2aDGJORb1K/CNxlXnvzx+2xyeQzzgFyC xHwOnxpBcaV6m5M9A2CqeaBOGiazg5WktB/KBh/peS+UAR9zJCdgUN5R0gSKYb2JxnV7 6xNarNKqbnwDt7V0PSxsnDDud7lXWSq0sYWeiV7m7BZA4neyNI6FYXWM1zKhm5CkwPQ8 +PUCNXdZQDtSLpi169FZRQHihCsJqCE/JILCEYzl87AhvVqIMF5k+wQHMTXirBRVwTPI 7T/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mgwShcemOtX0BVy1q/tyuiadVzWUjcA0MZ7ig1eIS5A=; b=EK913msEwUOczIzAP7mQl8aIlrRfwi++JhgkzmNmcf5aLPQYrXHNhKc4Dgv82qqVYH 8mAez0BKtL+UcFhi0hnUlkd18+CgcjiU2w8z339fXowp0k2jAHxx6czcU0L+TIBDYSmf hHMd8h4QI/GwS5CQir1MWUfhWwaluVFwHwvyLnbDQTSngXTunxEsgt0NfLNtPJgdyAli rOCUpM3E0y2TCHBEET/8LCBgWMF3imBgtKWVK+e/JW4hQKLUnjZqWrON46s1Vo3dksQV B7sSKp9Scu6rAoapGDm9XSW+IOLFtsPB7bahqWb3pBBk2/boDzp05LVJFLb2ygQD30Fo y3Xg== X-Gm-Message-State: AOAM532Vfsq3Dqi+55Bc9yOAVXTq95vg0p5tW3LgGf3HgazhUM3Tzu26 TpkO99czNXYTHKl1/SPOi5GsXhsuAluvBn9EPW41Y4TJGm2Yng== X-Google-Smtp-Source: ABdhPJxMWmKHQvMX7PB2OkVS1M27C+XlNGaDI5iVmFo9+AJJ7ZFrfjFvPl4gbvXPXQDvKiOj9gWzs0AA9iARZdxM13A= X-Received: by 2002:a5d:9a0b:: with SMTP id s11mr1278889iol.166.1622357089151; Sat, 29 May 2021 23:44:49 -0700 (PDT) MIME-Version: 1.0 References: <20210530063712.6832-1-ma.mandourr@gmail.com> In-Reply-To: <20210530063712.6832-1-ma.mandourr@gmail.com> From: Mahmoud Mandour Date: Sun, 30 May 2021 08:44:38 +0200 Message-ID: Subject: Re: [RFC PATCH v2 0/3] Cache modelling TCG plugin To: qemu-devel@nongnu.org Content-Type: multipart/alternative; boundary="000000000000ff721a05c386716d" Received-SPF: pass client-ip=2607:f8b0:4864:20::d35; envelope-from=ma.mandourr@gmail.com; helo=mail-io1-xd35.google.com 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, HTML_MESSAGE=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: "Emilio G. Cota" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000ff721a05c386716d Content-Type: text/plain; charset="UTF-8" On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour wrote: > In this RFC patch series, I propose an initial cache modelling TCG > plugin. As of now, it models separate L1 data cache and L1 instruction > cache. It supports three eviction policies: LRU, random, and FIFO. Once > a policy is chosen, it's used for both instruction and data caches. > > v1 -> v2: Unlocked dmtx on early return in vcpu_mem_access & removed a > (probably?) bad InsnData free. > This is probably still problematic since it does not free the > ``idata`` allocated for the vcpu_mem_access callback even > once, but if it's placed, it would double-free it. > How do I mitigate this? I need to free the InsnData passed to > vcpu_mem_access only once if we find out that it's an IO > access since we do not need it anymore and it will early > return every time. > > Mahmoud Mandour (3): > plugins: Added a new cache modelling plugin > plugins: cache: Enabled parameterization and added trace printing > plugins: cache: Added FIFO and LRU eviction policies. > > contrib/plugins/Makefile | 1 + > contrib/plugins/cache.c | 595 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 596 insertions(+) > create mode 100644 contrib/plugins/cache.c > > -- > 2.25.1 > > --000000000000ff721a05c386716d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, May 30, 2021 at 8:37 AM Mahmoud Mandour <ma.mandourr@gmail.com> wrote:=
In this RFC pat= ch series, I propose an initial cache modelling TCG
plugin. As of now, it models separate L1 data cache and L1 instruction
cache. It supports three eviction policies: LRU, random, and FIFO. Once
a policy is chosen, it's used for both instruction and data caches.

v1 -> v2: Unlocked dmtx on early return in vcpu_mem_access & removed= a
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (probably?) bad InsnData free.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 This is probably still problematic since= it does not free the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ``idata`` allocated for the vcpu_mem_acc= ess callback even
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 once, but if it's placed, it would d= ouble-free it.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 How do I mitigate this? I need to free t= he InsnData passed to
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vcpu_mem_access only once if we find out= that it's an IO
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 access since we do not need it anymore a= nd it will early
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return every time.

Mahmoud Mandour (3):
=C2=A0 plugins: Added a new cache modelling plugin
=C2=A0 plugins: cache: Enabled parameterization and added trace printing =C2=A0 plugins: cache: Added FIFO and LRU eviction policies.

=C2=A0contrib/plugins/Makefile |=C2=A0 =C2=A01 +
=C2=A0contrib/plugins/cache.c=C2=A0 | 595 +++++++++++++++++++++++++++++++++= ++++++
=C2=A02 files changed, 596 insertions(+)
=C2=A0create mode 100644 contrib/plugins/cache.c

--
2.25.1

--000000000000ff721a05c386716d--