All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres-GANU6spQydw@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: "enable ctxprog xfer only when we need it to save power" introduces big performance regression
Date: Fri, 13 Jan 2012 22:26:38 +0100	[thread overview]
Message-ID: <4F10A18E.1030908@free.fr> (raw)
In-Reply-To: <20111229013850.GA4076-OI9uyE9O0yo@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hi Marcin,

As promised, I started working on your performance problem.

Le 29/12/2011 02:38, Marcin Slusarz a écrit :
> I tried to implement xfers runtime switching, but couldn't figure out 
> how to change ctxprog behaviour without rebuilding and reuploading 
> whole thing. Reading host-writable memory from ctxprog would be enough. 
Well, I did that for you (see the patch enclosed). The patch uses the 
4th ctxprog flag register's bit 0 to store the wanted behaviour.
Mwk suggested me to do so and it worked perfectly.

You have all the instructions in the commit message, please report on 
the actual results!

By the mean time, I'll plug it to a PM brain so as it would switch back 
and forth between the two modes according to the load or the perflvl.

Take care,

Martin

[-- Attachment #2: 0001-drm-nv50-gr-make-ctxprog-decide-at-run-time-to-disab.patch --]
[-- Type: text/x-patch, Size: 2676 bytes --]

From 8e6667c87074b1b519fef0946083d46d01dfe8a0 Mon Sep 17 00:00:00 2001
From: Martin Peres <martin.peres-BktLLJ5BOkI@public.gmane.org>
Date: Fri, 13 Jan 2012 22:05:28 +0100
Subject: [PATCH] drm/nv50/gr: make ctxprog decide at run time to disable or
 not xfer

This commit is a follow-up on "drm/nv50/gr: enable ctxprog xfer only when we need it to save power".

The current situation is that some cards (nv92) have an hw regression that lower performance that
has been reported to about 15%.

This commit is the initial work to get the best of both world, that is to say:
- Performance when it is actually needed
- Power consumption when current performance is enough for the current needs

How-to:
- To go for performance      : nvapoke 400830 1
- To go for power consumption: nvapoke 400830 0

Then, force the card to do a context switch (switch to a TTY for instance).
Make sure it worked by peeking 400824. Bit 0x4000 is the XFER_ENABLE.

Reported-by: Marcin Slusarz <marcin.slusarz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Martin Peres <martin.peres-BktLLJ5BOkI@public.gmane.org>
---
 drivers/gpu/drm/nouveau/nv50_grctx.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_grctx.c b/drivers/gpu/drm/nouveau/nv50_grctx.c
index 4b46d69..b2fdb7d 100644
--- a/drivers/gpu/drm/nouveau/nv50_grctx.c
+++ b/drivers/gpu/drm/nouveau/nv50_grctx.c
@@ -74,6 +74,11 @@
 #define CP_FLAG_INTR_NOT_PENDING      0
 #define CP_FLAG_INTR_PENDING          1
 
+/* CTXCTL_FLAGS_3: should only be written by host ! */
+#define CP_FLAG_PM_XFER               ((3 * 32) + 0)
+#define CP_FLAG_PM_XFER_ENABLE        0
+#define CP_FLAG_PM_XFER_DISABLE       1
+
 #define CP_CTX                   0x00100000
 #define CP_CTX_COUNT             0x000f0000
 #define CP_CTX_COUNT_SHIFT               16
@@ -163,6 +168,7 @@ enum cp_label {
 	cp_setup_save,
 	cp_swap_state,
 	cp_prepare_exit,
+	cp_xfer,
 	cp_exit,
 };
 
@@ -263,13 +269,17 @@ nv50_grctx_init(struct nouveau_grctx *ctx)
 	cp_set (ctx, UNK03, CLEAR);
 	cp_set (ctx, UNK1D, CLEAR);
 
-	cp_bra (ctx, USER_SAVE, PENDING, cp_exit);
+	cp_bra (ctx, USER_SAVE, PENDING, cp_xfer);
 	cp_out (ctx, CP_NEXT_TO_CURRENT);
 
+	/* disable xfer unless we are told otherwise by the host */
+	cp_name(ctx, cp_xfer);
+	cp_bra (ctx, PM_XFER, DISABLE, cp_exit);
+	cp_set (ctx, XFER_SWITCH, DISABLE);
+
 	cp_name(ctx, cp_exit);
 	cp_set (ctx, USER_SAVE, NOT_PENDING);
 	cp_set (ctx, USER_LOAD, NOT_PENDING);
-	cp_set (ctx, XFER_SWITCH, DISABLE);
 	cp_set (ctx, STATE, STOPPED);
 	cp_out (ctx, CP_END);
 	ctx->ctxvals_pos += 0x400; /* padding... no idea why you need it */
-- 
1.7.8.3


[-- Attachment #3: Type: text/plain, Size: 181 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2012-01-13 21:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29 17:08 "enable ctxprog xfer only when we need it to save power" introduces big performance regression Marcin Slusarz
     [not found] ` <20111029170801.GA3219-OI9uyE9O0yo@public.gmane.org>
2011-10-29 17:29   ` Marcin Slusarz
     [not found]     ` <20111029172923.GA3110-OI9uyE9O0yo@public.gmane.org>
2011-10-29 18:00       ` Maarten Maathuis
     [not found]         ` <CAGZ4FETt6QzMkxrMQwJsszjuQq0wdt85ujRZbxkdurkduaHh2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-30  1:15           ` Ben Skeggs
2011-10-29 19:09       ` Marcin Slusarz
     [not found]         ` <20111029190938.GA3105-OI9uyE9O0yo@public.gmane.org>
2011-10-30  0:25           ` Maxim Levitsky
2011-10-30 10:33             ` Marcin Slusarz
     [not found]               ` <20111030103349.GA3157-OI9uyE9O0yo@public.gmane.org>
2011-10-30 10:37                 ` Marcin Kościelnicki
2011-11-09 22:10           ` Marcin Slusarz
     [not found]             ` <20111109221009.GD3402-OI9uyE9O0yo@public.gmane.org>
2011-11-10  7:10               ` Martin Peres
     [not found]                 ` <4EBB78F4.2020902-Iz16wY1oaNPLSKGbIzaifA@public.gmane.org>
2011-12-28 21:39                   ` Marcin Slusarz
     [not found]                     ` <20111228213902.GA4275-OI9uyE9O0yo@public.gmane.org>
2011-12-28 23:58                       ` Martin Peres
     [not found]                         ` <4EFBAD2B.8080207-Iz16wY1oaNPLSKGbIzaifA@public.gmane.org>
2011-12-29  1:38                           ` Marcin Slusarz
     [not found]                             ` <20111229013850.GA4076-OI9uyE9O0yo@public.gmane.org>
2012-01-13 21:26                               ` Martin Peres [this message]
     [not found]                                 ` <4F10A18E.1030908-GANU6spQydw@public.gmane.org>
2012-01-17 20:55                                   ` Lucas Stach
2012-01-17 21:17                                     ` Martin Peres

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=4F10A18E.1030908@free.fr \
    --to=martin.peres-ganu6spqydw@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.