Message ID | 1374230572-2983-1-git-send-email-xiong.y.zhang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Jul 19, 2013 at 06:42:51PM +0800, Xiong Zhang wrote: > V2: add exit handler to enable prefault (Daniel) > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Thanks a lot for doing these patches, I've merged them both. Just to check: Are the subtests added now instead of your gem_prefault testcase good enough to still hit all slowpaths? I have to admit that I didn't even really compile-test my little idea that I've pasted as a diff into my reply ;-) Cheers, Daniel > --- > lib/drmtest.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ > lib/drmtest.h | 3 +++ > 2 files changed, 53 insertions(+) > > diff --git a/lib/drmtest.c b/lib/drmtest.c > index 011d8c1..980fa49 100644 > --- a/lib/drmtest.c > +++ b/lib/drmtest.c > @@ -1593,3 +1593,53 @@ void kmstest_free_connector_config(struct kmstest_connector_config *config) > drmModeFreeEncoder(config->encoder); > drmModeFreeConnector(config->connector); > } > + > +#define PREFAULT_DEBUGFS "/sys/module/i915/parameters/prefault_disable" > +static int drmtest_prefault_control(bool enable) > +{ > + char *name = PREFAULT_DEBUGFS; > + int fd; > + char buf[2] = {'Y', 'N'}; > + int index; > + int result = 0; > + > + fd = open(name, O_RDWR); > + if (fd == -1) { > + fprintf(stderr, "Couldn't open prefault_debugfs.%s\n", > + strerror(errno)); > + return -1; > + } > + > + if (enable) > + index = 1; > + else > + index = 0; > + > + if (write(fd, &buf[index], 1) != 1) { > + fprintf(stderr, "write prefault_debugfs error.%s\n", > + strerror(errno)); > + result = -1; > + } > + > + close(fd); > + > + return result; > +} > + > +static void enable_prefault_at_exit(int sig) > +{ > + drmtest_enable_prefault(); > +} > + > +int drmtest_disable_prefault(void) > +{ > + drmtest_install_exit_handler(enable_prefault_at_exit); > + > + return drmtest_prefault_control(false); > +} > + > +int drmtest_enable_prefault(void) > +{ > + return drmtest_prefault_control(true); > +} > + > diff --git a/lib/drmtest.h b/lib/drmtest.h > index e3a9275..80b344c 100644 > --- a/lib/drmtest.h > +++ b/lib/drmtest.h > @@ -179,3 +179,6 @@ void drmtest_enable_exit_handler(void); > void drmtest_disable_exit_handler(void); > > int drmtest_set_vt_graphics_mode(void); > + > +int drmtest_disable_prefault(void); > +int drmtest_enable_prefault(void); > -- > 1.8.3.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Fri, Jul 19, 2013 at 06:14:27PM +0200, Daniel Vetter wrote: > On Fri, Jul 19, 2013 at 06:42:51PM +0800, Xiong Zhang wrote: > > V2: add exit handler to enable prefault (Daniel) > > > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> > > Thanks a lot for doing these patches, I've merged them both. Just to > check: Are the subtests added now instead of your gem_prefault testcase > good enough to still hit all slowpaths? I have to admit that I didn't even > really compile-test my little idea that I've pasted as a diff into my > reply ;-) gcc found a const mismatch and warned about it, I've fixed it up. -Daniel
Yes, I have tested it before I sent out the patch. It hit all the slow paths. Thanks. -----Original Message----- From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel Vetter Sent: Saturday, July 20, 2013 12:14 AM To: Zhang, Xiong Y Cc: intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] [PATCH 1/2] lib/drmtest: add drmtest_disable/enable_prefault() function On Fri, Jul 19, 2013 at 06:42:51PM +0800, Xiong Zhang wrote: > V2: add exit handler to enable prefault (Daniel) > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> Thanks a lot for doing these patches, I've merged them both. Just to check: Are the subtests added now instead of your gem_prefault testcase good enough to still hit all slowpaths? I have to admit that I didn't even really compile-test my little idea that I've pasted as a diff into my reply ;-) Cheers, Daniel > --- > lib/drmtest.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ > lib/drmtest.h | 3 +++ > 2 files changed, 53 insertions(+) > > diff --git a/lib/drmtest.c b/lib/drmtest.c index 011d8c1..980fa49 > 100644 > --- a/lib/drmtest.c > +++ b/lib/drmtest.c > @@ -1593,3 +1593,53 @@ void kmstest_free_connector_config(struct kmstest_connector_config *config) > drmModeFreeEncoder(config->encoder); > drmModeFreeConnector(config->connector); > } > + > +#define PREFAULT_DEBUGFS "/sys/module/i915/parameters/prefault_disable" > +static int drmtest_prefault_control(bool enable) { > + char *name = PREFAULT_DEBUGFS; > + int fd; > + char buf[2] = {'Y', 'N'}; > + int index; > + int result = 0; > + > + fd = open(name, O_RDWR); > + if (fd == -1) { > + fprintf(stderr, "Couldn't open prefault_debugfs.%s\n", > + strerror(errno)); > + return -1; > + } > + > + if (enable) > + index = 1; > + else > + index = 0; > + > + if (write(fd, &buf[index], 1) != 1) { > + fprintf(stderr, "write prefault_debugfs error.%s\n", > + strerror(errno)); > + result = -1; > + } > + > + close(fd); > + > + return result; > +} > + > +static void enable_prefault_at_exit(int sig) { > + drmtest_enable_prefault(); > +} > + > +int drmtest_disable_prefault(void) > +{ > + drmtest_install_exit_handler(enable_prefault_at_exit); > + > + return drmtest_prefault_control(false); } > + > +int drmtest_enable_prefault(void) > +{ > + return drmtest_prefault_control(true); } > + > diff --git a/lib/drmtest.h b/lib/drmtest.h index e3a9275..80b344c > 100644 > --- a/lib/drmtest.h > +++ b/lib/drmtest.h > @@ -179,3 +179,6 @@ void drmtest_enable_exit_handler(void); > void drmtest_disable_exit_handler(void); > > int drmtest_set_vt_graphics_mode(void); > + > +int drmtest_disable_prefault(void); > +int drmtest_enable_prefault(void); > -- > 1.8.3.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
diff --git a/lib/drmtest.c b/lib/drmtest.c index 011d8c1..980fa49 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -1593,3 +1593,53 @@ void kmstest_free_connector_config(struct kmstest_connector_config *config) drmModeFreeEncoder(config->encoder); drmModeFreeConnector(config->connector); } + +#define PREFAULT_DEBUGFS "/sys/module/i915/parameters/prefault_disable" +static int drmtest_prefault_control(bool enable) +{ + char *name = PREFAULT_DEBUGFS; + int fd; + char buf[2] = {'Y', 'N'}; + int index; + int result = 0; + + fd = open(name, O_RDWR); + if (fd == -1) { + fprintf(stderr, "Couldn't open prefault_debugfs.%s\n", + strerror(errno)); + return -1; + } + + if (enable) + index = 1; + else + index = 0; + + if (write(fd, &buf[index], 1) != 1) { + fprintf(stderr, "write prefault_debugfs error.%s\n", + strerror(errno)); + result = -1; + } + + close(fd); + + return result; +} + +static void enable_prefault_at_exit(int sig) +{ + drmtest_enable_prefault(); +} + +int drmtest_disable_prefault(void) +{ + drmtest_install_exit_handler(enable_prefault_at_exit); + + return drmtest_prefault_control(false); +} + +int drmtest_enable_prefault(void) +{ + return drmtest_prefault_control(true); +} + diff --git a/lib/drmtest.h b/lib/drmtest.h index e3a9275..80b344c 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -179,3 +179,6 @@ void drmtest_enable_exit_handler(void); void drmtest_disable_exit_handler(void); int drmtest_set_vt_graphics_mode(void); + +int drmtest_disable_prefault(void); +int drmtest_enable_prefault(void);
V2: add exit handler to enable prefault (Daniel) Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> --- lib/drmtest.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ lib/drmtest.h | 3 +++ 2 files changed, 53 insertions(+)