From: John Wehle <john@feith.com>
To: sid@sources.redhat.com
Subject: sid-20110801 Patch to fix cache writeback latency
Date: Tue, 01 Nov 2011 14:29:00 -0000 [thread overview]
Message-ID: <201110160503.p9G53XJI025574@jwlab.FEITH.COM> (raw)
Message-ID: <20111101142900.XxttOEm3lYlYe8xCwBRP7Relb6bct5rRx1UniF2cCNU@z> (raw)
Currently when the SID cache component replaces a line which is dirty
it writes back the data to memory. However it ignores that fact that
the writeback adds to the latency causing the simulation to believe
that the replacement of a dirty cache line takes the same amount of
time as the replacement of a clean cache line.
The enclosed patch has been tested on FreeBSD with sid configured for
tomi Borealis (a processor under development by Venray Technology).
ChangeLog:
Sun Oct 16 00:03:43 EDT 2011 John Wehle (john@feith.com)
* component/cache/cache.cxx (write_any, read_any): Latency
should include the writeback of a dirty line.
-- John
------------------------8<------------------------------8<---------------
--- component/cache/cache.cxx.ORIGINAL 2009-04-08 16:39:34.000000000 -0400
+++ component/cache/cache.cxx 2011-10-13 00:22:20.000000000 -0400
@@ -184,7 +182,7 @@ template <typename DataType>
bus::status
cache_component::write_any (host_int_4 addr, DataType data)
{
- bus::status st, read_status;
+ bus::status st, read_status, writeback_status;
if (UNLIKELY (downstream == 0))
return bus::unmapped;
@@ -237,8 +235,8 @@ cache_component::write_any (host_int_4 a
if (expelled_line->valid_p () && expelled_line->dirty_p ())
{
// flush a dirty line being replaced
- if ((st = write_line (*expelled_line)) != bus::ok)
- return st;
+ if ((writeback_status = write_line (*expelled_line)) != bus::ok)
+ return writeback_status;
}
}
else
@@ -279,7 +277,7 @@ cache_component::write_any (host_int_4 a
if (line)
st.latency = hit_latency;
else
- st.latency = read_status.latency + miss_latency;
+ st.latency = writeback_status.latency + read_status.latency + miss_latency;
return st;
}
@@ -287,7 +285,7 @@ template <typename DataType>
bus::status
cache_component::read_any (host_int_4 addr, DataType& data)
{
- bus::status st, read_status;
+ bus::status st, read_status, writeback_status;
if (UNLIKELY (downstream == 0))
return bus::unmapped;
@@ -327,8 +325,8 @@ cache_component::read_any (host_int_4 ad
if (expelled_line->valid_p () && expelled_line->dirty_p ())
{
// flush a dirty line being replaced
- if ((st = write_line (*expelled_line)) != bus::ok)
- return st;
+ if ((writeback_status = write_line (*expelled_line)) != bus::ok)
+ return writeback_status;
}
expelled_line->set_tag (tag);
if ((read_status = read_line (*expelled_line)) != bus::ok)
@@ -353,7 +351,7 @@ cache_component::read_any (host_int_4 ad
if (line)
st.latency += hit_latency;
else
- st.latency = read_status.latency + miss_latency;
+ st.latency = writeback_status.latency + read_status.latency + miss_latency;
return st;
}
-------------------------------------------------------------------------
next reply other threads:[~2011-10-16 8:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 7:58 John Wehle [this message]
2011-11-01 14:29 ` John Wehle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201110160503.p9G53XJI025574@jwlab.FEITH.COM \
--to=john@feith.com \
--cc=sid@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).